gconfig.go
func getGoPath() (string, error) {
	wd, err := os.Getwd()
	if err != nil {
		return "", err
	}

	gopath := os.Getenv("GOPATH")
	if gopath == "" {
		return "", fmt.Errorf("GOPATH not set, it's needed to run go program")
	}

	// Split out multiple GOPATHs if necessary
	if s.Contains(gopath, ":") {
		paths := s.Split(gopath, ":")
		for _, path := range paths {
			if s.Contains(wd, path) {
				gopath = path
				break
			}
		}
	}

	if !s.Contains(wd, gopath) {
		return "", fmt.Errorf("gconfig can only be executed within a directory in"+
			" the GOPATH, wd: %s, gopath: %s", wd, gopath)
	}
	return gopath, nil
}
func getGoPath() (string, error) {
	wd, err := os.Getwd()
	if err != nil {
		return "", err
	}

	gopath := os.Getenv("GOPATH")
	if gopath == "" {
		return "", fmt.Errorf("GOPATH not set, it's needed to run go program")
	}

	// Split out multiple GOPATHs if necessary
	if s.Contains(gopath, ":") {
		paths := s.Split(gopath, ":")
		for _, path := range paths {
			if s.Contains(wd, path) {
				gopath = path
				break
			}
		}
	}

	if !s.Contains(wd, gopath) {
		return "", fmt.Errorf("gconfig can only be executed within a directory in"+
			" the GOPATH, wd: %s, gopath: %s", wd, gopath)
	}
	return gopath, nil
}
// getGoPath returns a single GOPATH. If there are multiple defined in the users
// $GOPATH env variable, then getGoPath validates that the working directory is
// part of one of the GOPATHs, and uses the first one it finds that does.