From 426c84d8fa1c168c2ae95b315917b3a3e34a3d53 Mon Sep 17 00:00:00 2001 From: Tommaso Sardelli Date: Sat, 29 Sep 2018 19:01:21 +0200 Subject: [PATCH] Skip -i flag in go build if modules are enabled (#1337) Using -i flag when running go build is not useful with go modules enabled and in some cases can lead to a bug, with go trying to rebuild shipped vendorized dependencies as described in this issue golang/go#27285. With this commit we check if go modules are enabled and we drop the -i flag accordingly. --- buffalo/cmd/build/bin.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buffalo/cmd/build/bin.go b/buffalo/cmd/build/bin.go index 79fd05fb7..c8da52412 100644 --- a/buffalo/cmd/build/bin.go +++ b/buffalo/cmd/build/bin.go @@ -5,15 +5,20 @@ import ( "strings" "github.com/gobuffalo/envy" + "github.com/gobuffalo/genny/movinglater/gotools/gomods" "github.com/pkg/errors" ) func (b *Builder) buildBin() error { - buildArgs := []string{"build", "-i"} + buildArgs := []string{"build"} if b.Debug { buildArgs = append(buildArgs, "-v") } + if !gomods.On() { + buildArgs = append(buildArgs, "-i") + } + tf := b.App.BuildTags(b.Environment, b.Tags...) buildArgs = append(buildArgs, "-tags", tf.String())