This file is indexed.

/usr/share/gocode/src/github.com/smartystreets/goconvey/web/server/system/shell.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package system

import (
	"os"
	"os/exec"
	"runtime"
)

type Shell struct {
	coverage string
	gobin    string
}

func (self *Shell) GoTest(directory string) (output string, err error) {
	output, err = self.execute(directory, self.gobin, "test", "-i")
	if err == nil {
		output, err = self.execute(directory, self.gobin, "test", "-v", "-timeout=-42s", self.coverage)
	}
	return
}

func (self *Shell) execute(directory, name string, args ...string) (output string, err error) {
	command := exec.Command(name, args...)
	command.Dir = directory
	rawOutput, err := command.CombinedOutput()
	output = string(rawOutput)
	return
}

func (self *Shell) Getenv(key string) string {
	return os.Getenv(key)
}

func (self *Shell) Setenv(key, value string) error {
	if self.Getenv(key) != value {
		return os.Setenv(key, value)
	}
	return nil
}

func NewShell(gobin string) *Shell {
	self := new(Shell)
	self.gobin = gobin
	if goVersion_1_2_orGreater() {
		self.coverage = coverageFlag
	}
	return self
}

func goVersion_1_2_orGreater() bool {
	version := runtime.Version() // 'go1.2....'
	major, minor := version[2], version[4]
	return major >= byte('1') && minor >= byte('2')
}

const coverageFlag = "-cover"