gopkg.in/tools/godep.v19@v19.0.0-20151103222550-d423d08236e8/path.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  )
     7  
     8  var cmdPath = &Command{
     9  	Usage: "path",
    10  	Short: "print GOPATH for dependency code",
    11  	Long: `
    12  Command path prints a path for use in env var GOPATH
    13  that makes available the specified version of each dependency.
    14  
    15  The printed path does not include any GOPATH value from
    16  the environment.
    17  
    18  For more about how GOPATH works, see 'go help gopath'.
    19  `,
    20  	Run: runPath,
    21  }
    22  
    23  // Print the gopath that points to
    24  // the included dependency code.
    25  func runPath(cmd *Command, args []string) {
    26  	if len(args) != 0 {
    27  		cmd.UsageExit()
    28  	}
    29  	if VendorExperiment {
    30  		fmt.Fprintln(os.Stderr, "Error: GOVENDOREXPERIMENT is enabled and the vendor/ directory is not a valid Go workspace.")
    31  		os.Exit(1)
    32  	}
    33  	gopath := prepareGopath()
    34  	fmt.Println(gopath)
    35  }