Skip to content
Myr

cmd: Make more accurate error when there is no $GOPATH

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Albert Nigmatzianov · committed by Albert Nigmatzianov · parent fa9ac85 · Browse files · 1 file+3 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−4 removed

  • other:+3 added−4 removed

1 file+3 added−4 removed

modified:cobra/cmd/helpers.go+3 added-4 removed
25 unmodified lines
26var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"}27var srcPaths []string2829func init() {30 // Initialize goPaths and srcPaths30 // Initialize srcPaths.31 envGoPath := os.Getenv("GOPATH")32 if envGoPath == "" {32 goPaths := filepath.SplitList(envGoPath)33 if len(goPaths) == 0 {34 er("$GOPATH is not set")35 }3536 goPaths := filepath.SplitList(envGoPath)36 srcPaths = make([]string, 0, len(goPaths))37 for _, goPath := range goPaths {38 srcPaths = append(srcPaths, filepath.Join(goPath, "src"))39 }
101 unmodified lines