aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gobuffalo/packr/env.go
blob: 2c744e71afbc2e89986f4f622cec78ae8d43306c (plain)
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
package packr

import (
	"go/build"
	"os"
	"strings"
)

// GoPath returns the current GOPATH env var
// or if it's missing, the default.
func GoPath() string {
	go_path := strings.Split(os.Getenv("GOPATH"), string(os.PathListSeparator))
	if len(go_path) == 0 || go_path[0] == "" {
		return build.Default.GOPATH
	}
	return go_path[0]
}

// GoBin returns the current GO_BIN env var
// or if it's missing, a default of "go"
func GoBin() string {
	go_bin := os.Getenv("GO_BIN")
	if go_bin == "" {
		return "go"
	}
	return go_bin
}