dip/vendor/github.com/gobuffalo/packr/v2/internal/envy.go
Paul Lecuq 573d8f49e4
Some checks failed
continuous-integration/drone/push Build is failing
updated vendors
2020-08-01 19:02:19 +02:00

38 lines
623 B
Go

package internal
import (
"os"
"runtime"
"strings"
)
// Mods returns true when go modules supports is enabled
func Mods() bool {
go111 := os.Getenv("GO111MODULE")
if !inGoPath() {
return go111 != "off"
}
return go111 == "on"
}
func inGoPath() bool {
pwd, _ := os.Getwd()
for _, p := range GoPaths() {
if strings.HasPrefix(pwd, p) {
return true
}
}
return false
}
// GoPaths return the defined gopath list.
func GoPaths() []string {
gp := os.Getenv("GOPATH")
if runtime.GOOS == "windows" {
return strings.Split(gp, ";") // Windows uses a different separator
}
return strings.Split(gp, ":")
}