Skip to content

Commit 6e4526c

Browse files
authored
Use go install instead of go get (#4672)
Calling `go get` was causing `mage check` to fail with: ``` go: modules disabled by GO111MODULE=off; see 'go help modules' Error: running "go get github.com/elastic/go-licenser@latest" failed with exit code 1 ``` This commit fixes it by using `go install` instead.
1 parent e6e3f67 commit 6e4526c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

magefile.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ func (Dev) Package() {
205205

206206
// InstallGoLicenser install go-licenser to check license of the files.
207207
func (Prepare) InstallGoLicenser() error {
208-
return GoGet(goLicenserRepo)
208+
return GoInstall(goLicenserRepo)
209209
}
210210

211211
// InstallGoLint for the code.
212212
func (Prepare) InstallGoLint() error {
213-
return GoGet(goLintRepo)
213+
return GoInstall(goLintRepo)
214214
}
215215

216216
// All build all the things for the current projects.
@@ -560,9 +560,9 @@ func RunGo(args ...string) error {
560560
return sh.RunV(mg.GoCmd(), args...)
561561
}
562562

563-
// GoGet fetch a remote dependencies.
564-
func GoGet(link string) error {
565-
_, err := sh.Exec(map[string]string{"GO111MODULE": "off"}, os.Stdout, os.Stderr, "go", "get", link)
563+
// GoInstall installs a tool by calling `go install <link>
564+
func GoInstall(link string) error {
565+
_, err := sh.Exec(map[string]string{}, os.Stdout, os.Stderr, "go", "install", link)
566566
return err
567567
}
568568

0 commit comments

Comments
 (0)