2018-01-28 14:56:30 +00:00
|
|
|
// Copyright 2013, 2014 Canonical Ltd.
|
|
|
|
// Licensed under the LGPLv3, see LICENCE file for details.
|
|
|
|
|
|
|
|
package errors
|
|
|
|
|
|
|
|
import (
|
2019-04-21 17:58:15 +00:00
|
|
|
"fmt"
|
|
|
|
"go/build"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2018-01-28 14:56:30 +00:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2019-04-21 17:58:15 +00:00
|
|
|
var goPath = build.Default.GOPATH
|
|
|
|
var srcDir = filepath.Join(goPath, "src")
|
2018-01-28 14:56:30 +00:00
|
|
|
|
|
|
|
func trimGoPath(filename string) string {
|
2019-04-21 17:58:15 +00:00
|
|
|
return strings.TrimPrefix(filename, fmt.Sprintf("%s%s", srcDir, string(os.PathSeparator)))
|
2018-01-28 14:56:30 +00:00
|
|
|
}
|