This file is indexed.

/usr/share/gocode/src/github.com/smartystreets/goconvey/web/server/watcher/gopath.go is in golang-github-smartystreets-goconvey-dev 1.5.0-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
34
35
36
37
38
package watcher

import (
	"fmt"
	"path/filepath"
	"strings"

	"github.com/smartystreets/goconvey/web/server/contract"
)

type goPath struct {
	shell contract.Shell
}

func (self *goPath) ResolvePackageName(folder string) string {
	for _, workspace := range strings.Split(self.current(), delimiter) {
		if strings.HasPrefix(folder, workspace) {
			prefix := filepath.Join(workspace, "src") + separator
			return folder[len(prefix):]
		}
	}

	panic(fmt.Sprintln(resolutionError, self.current()))
}

func (self *goPath) current() string {
	return self.shell.Getenv("GOPATH")
}

func newGoPath(shell contract.Shell) *goPath {
	self := &goPath{}
	self.shell = shell
	return self
}

const delimiter = string(filepath.ListSeparator)
const separator = string(filepath.Separator)
const resolutionError = "Package cannot be resolved as it is outside of any workspaces listed in the current $GOPATH:"