/usr/share/gocode/src/github.com/mailru/easyjson/parser/parser_windows.go is in golang-github-mailru-easyjson-dev 0.0~git20161103.0.159cdb8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | package parser
import (
"fmt"
"os"
"path"
"strings"
)
func normalizePath(path string) string {
return strings.Replace(path, "\\", "/", -1)
}
func getPkgPath(fname string) (string, error) {
if !path.IsAbs(fname) {
pwd, err := os.Getwd()
if err != nil {
return "", err
}
fname = path.Join(pwd, fname)
}
fname = normalizePath(fname)
for _, p := range strings.Split(os.Getenv("GOPATH"), ";") {
prefix := path.Join(normalizePath(p), "src") + "/"
if rel := strings.TrimPrefix(fname, prefix); rel != fname {
return path.Dir(rel), nil
}
}
return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
}
|