diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-08-25 17:58:04 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-08-25 20:50:58 +0200 |
commit | 45c9c45d1d0d99443fa6bb524a1265fa9ba95e0e (patch) | |
tree | c92be61768be071fe08cc0a26989bdf4314e59e5 /magefile.go | |
parent | fce32c07fb80e9929bc2660cf1e681e93009d24b (diff) | |
download | hugo-45c9c45d1d0d99443fa6bb524a1265fa9ba95e0e.tar.gz hugo-45c9c45d1d0d99443fa6bb524a1265fa9ba95e0e.zip |
Use Go 1.11 modules with Mage
See #5115
Diffstat (limited to 'magefile.go')
-rw-r--r-- | magefile.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/magefile.go b/magefile.go index e8a9a7b5f..ecc4b0b58 100644 --- a/magefile.go +++ b/magefile.go @@ -32,14 +32,26 @@ func init() { if exe := os.Getenv("GOEXE"); exe != "" { goexe = exe } + + // We want to use Go 1.11 modules even if the source lives inside GOPATH. + // The default is "auto". + os.Setenv("GO111MODULE", "on") } func getDep() error { + if !isWindows() { + // We only need this on Appveyor. + // TODO(bep) go11 clean up the vendor stuff once Appveyor gets Go 1.11. + return nil + } return sh.Run(goexe, "get", "-u", "github.com/golang/dep/cmd/dep") } // Install Go Dep and sync Hugo's vendored dependencies func Vendor() error { + if !isWindows() { + return nil + } mg.Deps(getDep) return sh.Run("dep", "ensure") } @@ -268,6 +280,10 @@ func isGoLatest() bool { return strings.Contains(runtime.Version(), "1.11") } +func isWindows() bool { + return runtime.GOOS == "windows" +} + func buildTags() string { // To build the extended Hugo SCSS/SASS enabled version, build with // HUGO_BUILD_TAGS=extended mage install etc. |