func Gopath() string {
	gopaths := Gopaths()
	if len(gopaths) == 0 {
		return ""
	}
	return gopaths[0]
}
Gopath gets GOPATH from environment and return the most relevant path.

A GOPATH can contain a colon-separated list of paths. This retrieves the
GOPATH and returns only the FIRST ("most relevant") path.

This should be used carefully. If, for example, you are looking for a package,
you may be better off using Gopaths.
package path
import (
	"fmt"
	"io"
	"os"
	"os/user"
	"path/filepath"
	"strings"
)
const DefaultGlideFile = "glide.yaml"
var VendorDir = "vendor"
var Tmp = ""
var homeDir = ""
var GlideFile = DefaultGlideFile
const LockFile = "glide.lock"
func Home() string {
	if homeDir != "" {
		return homeDir
	}
	u, err := user.Current()
	if err == nil && u.HomeDir != "" {
		homeDir = filepath.Join(u.HomeDir, ".glide")
	} else {
		cwd, err := os.Getwd()
		if err == nil {
			homeDir = filepath.Join(cwd, ".glide")
		} else {
			homeDir = ".glide"
		}
	}
	return homeDir
}
func SetHome(h string) {
	homeDir = h
}
func Vendor() (string, error) {
	cwd, err := os.Getwd()
	if err != nil {
		return "", err
	}
	yamldir, err := GlideWD(cwd)
	if err != nil {
		return cwd, err
	}
	gopath := filepath.Join(yamldir, VendorDir)
	info, err := os.Lstat(gopath)
	if err != nil {
		return gopath, nil
	}
	for i := 0; IsLink(info) && i < 255; i++ {
		p, err := os.Readlink(gopath)
		if err != nil {
			return gopath, nil
		}
		if filepath.IsAbs(p) {
			gopath = p
		} else {
			gopath = filepath.Join(filepath.Dir(gopath), p)
		}
		info, err = os.Lstat(gopath)
		if err != nil {
			return gopath, nil
		}
	}
	return gopath, nil
}
func Glide() (string, error) {
	cwd, err := os.Getwd()
	if err != nil {
		return "", err
	}
	yamldir, err := GlideWD(cwd)
	if err != nil {
		return cwd, err
	}
	gf := filepath.Join(yamldir, GlideFile)
	return gf, nil
}
func GlideWD(dir string) (string, error) {
	fullpath := filepath.Join(dir, GlideFile)
	if _, err := os.Stat(fullpath); err == nil {
		return dir, nil
	}
	base := filepath.Dir(dir)
	if base == dir {
		return "", fmt.Errorf("Cannot resolve parent of %s", base)
	}
	return GlideWD(base)
}