2018-06-04 10:18:55 +00:00
|
|
|
// Copyright 2013, 2014 Canonical Ltd.
|
|
|
|
// Licensed under the LGPLv3, see LICENCE file for details.
|
|
|
|
|
|
|
|
package errors
|
|
|
|
|
|
|
|
import (
|
2018-09-28 21:49:57 +00:00
|
|
|
"fmt"
|
|
|
|
"go/build"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2018-06-04 10:18:55 +00:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2018-09-28 21:49:57 +00:00
|
|
|
var goPath = build.Default.GOPATH
|
|
|
|
var srcDir = filepath.Join(goPath, "src")
|
2018-06-04 10:18:55 +00:00
|
|
|
|
|
|
|
func trimGoPath(filename string) string {
|
2018-09-28 21:49:57 +00:00
|
|
|
return strings.TrimPrefix(filename, fmt.Sprintf("%s%s", srcDir, string(os.PathSeparator)))
|
2018-06-04 10:18:55 +00:00
|
|
|
}
|