forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
path.go
36 lines (31 loc) · 795 Bytes
/
path.go
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
package main
import (
"fmt"
"os"
)
var cmdPath = &Command{
Name: "path",
Short: "print GOPATH for dependency code",
Long: `
Command path prints a path for use in env var GOPATH
that makes available the specified version of each dependency.
The printed path does not include any GOPATH value from
the environment.
For more about how GOPATH works, see 'go help gopath'.
`,
Run: runPath,
OnlyInGOPATH: true,
}
// Print the gopath that points to
// the included dependency code.
func runPath(cmd *Command, args []string) {
if len(args) != 0 {
cmd.UsageExit()
}
if VendorExperiment {
fmt.Fprintln(os.Stderr, "Error: GO15VENDOREXPERIMENT is enabled and the vendor/ directory is not a valid Go workspace.")
os.Exit(1)
}
gopath := prepareGopath()
fmt.Println(gopath)
}