aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gobuffalo/packr/env.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2018-08-01 00:37:11 +0100
committerNiall Sheridan <nsheridan@gmail.com>2018-08-01 00:37:11 +0100
commite2b4c3882762406fd3da16f5865cfc3e36e048b5 (patch)
tree4554004f44fe69a759d37191b8a6236ec0f2c90e /vendor/github.com/gobuffalo/packr/env.go
parent925bc7eb676e25341e30d64da4d12c0e93102cdf (diff)
Migrate from esc to packr for static files
Diffstat (limited to 'vendor/github.com/gobuffalo/packr/env.go')
-rw-r--r--vendor/github.com/gobuffalo/packr/env.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/gobuffalo/packr/env.go b/vendor/github.com/gobuffalo/packr/env.go
new file mode 100644
index 0000000..2c744e7
--- /dev/null
+++ b/vendor/github.com/gobuffalo/packr/env.go
@@ -0,0 +1,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
+}