From 9239b6d2bedf4f82be44a355625aafad0b328f27 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Wed, 12 May 2021 20:55:02 +0200 Subject: [PATCH] Added support for pinning build flags and environment variables. Fixes: https://github.com/bwplotka/bingo/issues/46 Signed-off-by: Bartlomiej Plotka --- CHANGELOG.md | 16 ++- README.md | 19 +++ get.go | 19 +-- get_e2e_test.go | 6 +- main.go | 1 + pkg/bingo/mod.go | 47 ++++++- pkg/bingo/mod_test.go | 116 +++++++++++++++--- pkg/bingo/test.mod | 2 +- pkg/bingo/test2.mod | 2 +- pkg/bingo/test3.mod | 2 +- pkg/bingo/test4.mod | 2 +- pkg/bingo/test5.mod | 2 +- pkg/bingo/variables.go | 2 +- pkg/runner/runner.go | 50 ++++---- pkg/version/version.go | 2 +- .../.bingo/.gitignore | 12 ++ .../.bingo/README.md | 14 +++ .../.bingo/Variables.mk | 67 ++++++++++ .../.bingo/buildable.mod | 5 + .../.bingo/buildable2.mod | 5 + .../.bingo/buildable_old.mod | 5 + .../.bingo/f2.1.mod | 5 + .../.bingo/f2.2.mod | 5 + .../.bingo/f2.3.mod | 5 + .../.bingo/f2.mod | 5 + .../.bingo/faillint.mod | 5 + .../.bingo/go-bindata.mod | 5 + .../.bingo/go.mod | 1 + .../.bingo/variables.env | 24 ++++ .../.bingo/wr_buildable.mod | 7 ++ 30 files changed, 401 insertions(+), 57 deletions(-) create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/.gitignore create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/README.md create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/Variables.mk create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/buildable.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/buildable2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/buildable_old.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/f2.1.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/f2.2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/f2.3.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/f2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/go-bindata.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/go.mod create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/variables.env create mode 100644 testdata/testproject_with_bingo_v0_4_1/.bingo/wr_buildable.mod diff --git a/CHANGELOG.md b/CHANGELOG.md index 453a312..5af7f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,23 @@ We use *breaking* word for marking changes that are not backward compatible (rel ## (Under development) +## [v0.4.1](https://github.com/bwplotka/bingo/releases/tag/v0.4.1) - 2021.05.12 + +### Added + +* Added support for build flags and envs via go.mod file. + +### Fixed + +* Generated files have limited permission. +* Support for Go pre-released versions. + + ## [v0.4.0](https://github.com/bwplotka/bingo/releases/tag/v0.4.0) - 2021.03.24 -* Added support for Go 1.16, following the changes it introduces in the module system: https://blog.golang.org/go116-module-changes +### Added + +* Added support for Go 1.16, following the changes it introduces in the module system: https://blog.golang.org/go116-module-changes. ## [v0.3.1](https://github.com/bwplotka/bingo/releases/tag/v0.3.1) - 2021.02.02 diff --git a/README.md b/README.md index 76726bc..95eb2bf 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,25 @@ Let's show a few, real, sometimes novel examples showcasing `bingo` capabilities ${GOBIN}/thanos-v0.17.2 --help ``` +## Advanced Techniques + +* Using advanced go build flags and environment variables. + +To tell bingo to use certain env vars and tags during build time, just add them as a comment to the go.mod file manually and do +`bingo get`. Done! + +NOTE: Order of comment matters. First bingo expects relative package name (optional), then environment variables, then flags. All space delimited. + +Real example from production project that relies on extended Hugo. + +``` +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/gohugoio/hugo v0.83.1 // CGO_ENABLED=1 -tags=extended +``` + ## Production Usage To see production example see: diff --git a/get.go b/get.go index 153595a..2756095 100644 --- a/get.go +++ b/get.go @@ -280,6 +280,8 @@ func get(ctx context.Context, logger *log.Logger, c getConfig, rawTarget string) target.Module.Version = mf.DirectPackage().Module.Version } target.RelPath = mf.DirectPackage().RelPath + target.BuildFlags = mf.DirectPackage().BuildFlags + target.BuildEnvs = mf.DirectPackage().BuildEnvs // Save for future versions without potentially existing files. pkgPath = target.Path() @@ -530,6 +532,7 @@ func getPackage(ctx context.Context, logger *log.Logger, c installPackageConfig, if c.verbose { logger.Println("getting target", target.String(), "(module", target.Module.Path, ")") } + // The out module file we generate/maintain keep in modDir. outModFile := filepath.Join(c.modDir, name+".mod") tmpEmptyModFilePath := filepath.Join(c.modDir, name+"-e.tmp.mod") @@ -551,7 +554,7 @@ func getPackage(ctx context.Context, logger *log.Logger, c installPackageConfig, } defer errcapture.Do(&err, tmpEmptyModFile.Close, "close") - runnable := c.runner.With(ctx, tmpEmptyModFile.FileName(), c.modDir) + runnable := c.runner.With(ctx, tmpEmptyModFile.FileName(), c.modDir, nil) if err := resolvePackage(logger, c.verbose, tmpEmptyModFile.FileName(), runnable, c.update, &target); err != nil { return err } @@ -588,8 +591,7 @@ func getPackage(ctx context.Context, logger *log.Logger, c installPackageConfig, return err } - runnable := c.runner.With(ctx, tmpModFile.FileName(), c.modDir) - if err := install(runnable, name, c.link, tmpModFile.DirectPackage()); err != nil { + if err := install(ctx, c.runner, c.modDir, name, c.link, tmpModFile); err != nil { return errors.Wrap(err, "install") } @@ -642,7 +644,6 @@ func autoFetchReplaceStatements(runnable runner.Runnable, target bingo.Package) return nil, errors.Wrapf(err, "parse target mod file %v", targetModFile) } return targetModParsed.Replace, nil - } // gobin mimics the way go install finds where to install go tool. @@ -654,7 +655,8 @@ func gobin() string { return binPath } -func install(runnable runner.Runnable, name string, link bool, pkg *bingo.Package) (err error) { +func install(ctx context.Context, r *runner.Runner, modDir string, name string, link bool, modFile *bingo.ModFile) (err error) { + pkg := modFile.DirectPackage() if err := validateTargetName(name); err != nil { return errors.Wrap(err, pkg.String()) } @@ -662,7 +664,10 @@ func install(runnable runner.Runnable, name string, link bool, pkg *bingo.Packag // Two purposes of doing list with mod=mod: // * Check if path is pointing to non-buildable package. // * Rebuild go.sum and go.mod (tidy) which is required to build with -mod=readonly (default) to work. - if listOutput, err := runnable.List(runner.NoUpdatePolicy, "-mod=mod", "-f={{.Name}}", pkg.Path()); err != nil { + var listArgs []string + listArgs = append(listArgs, modFile.DirectPackage().BuildFlags...) + listArgs = append(listArgs, "-mod=mod", "-f={{.Name}}", pkg.Path()) + if listOutput, err := r.With(ctx, modFile.FileName(), modDir, nil).List(runner.NoUpdatePolicy, listArgs...); err != nil { return errors.Wrap(err, "list") } else if !strings.HasSuffix(listOutput, "main") { return errors.Errorf("package %s is non-main (go list output %q), nothing to get and build", pkg.Path(), listOutput) @@ -672,7 +677,7 @@ func install(runnable runner.Runnable, name string, link bool, pkg *bingo.Packag // go install does not define -modfile flag so so we mimic go install with go build -o instead. binPath := filepath.Join(gobin, fmt.Sprintf("%s-%s", name, pkg.Module.Version)) - if err := runnable.Build(pkg.Path(), binPath); err != nil { + if err := r.With(ctx, modFile.FileName(), modDir, pkg.BuildEnvs).Build(pkg.Path(), binPath, pkg.BuildFlags...); err != nil { return errors.Wrap(err, "build versioned") } diff --git a/get_e2e_test.go b/get_e2e_test.go index 91c39d1..b9e1745 100644 --- a/get_e2e_test.go +++ b/get_e2e_test.go @@ -702,7 +702,7 @@ func TestGet(t *testing.T) { }, expectRows: []row{ // TODO(bwplotka) This will be painful to maintain, but well... improve it - {name: "thanos", binName: "thanos-v0.19.0", pkgVersion: "github.com/thanos-io/thanos/cmd/thanos@v0.19.0"}, + {name: "thanos", binName: "thanos-v0.20.1", pkgVersion: "github.com/thanos-io/thanos/cmd/thanos@v0.20.1"}, }, expectBinaries: []string{ "buildable", @@ -712,7 +712,7 @@ func TestGet(t *testing.T) { "f2-v1.0.0", "f2-v1.1.0", "f2-v1.2.0", "f2-v1.3.0", "f2-v1.4.0", "f2-v1.5.0", "f3-v1.1.0", "f3-v1.3.0", "f3-v1.4.0", "faillint-v1.0.0", "faillint-v1.1.0", "faillint-v1.3.0", "faillint-v1.4.0", "faillint-v1.5.0", "go-bindata-v3.1.1+incompatible", - "thanos-v0.13.1-0.20210108102609-f85e4003ba51", "thanos-v0.19.0", + "thanos-v0.13.1-0.20210108102609-f85e4003ba51", "thanos-v0.20.1", "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a", "wr_buildable-v0.0.0-20210110214650-ab990d1be30b", }, }, @@ -727,7 +727,7 @@ func TestGet(t *testing.T) { }, expectRows: []row{ // TODO(bwplotka) This will be painful to maintain, but well... improve it - {name: "thanos", binName: "thanos-v0.19.0", pkgVersion: "github.com/thanos-io/thanos/cmd/thanos@v0.19.0"}, + {name: "thanos", binName: "thanos-v0.20.1", pkgVersion: "github.com/thanos-io/thanos/cmd/thanos@v0.20.1"}, }, expectSameBinariesAsBefore: true, }, diff --git a/main.go b/main.go index 18fe1d8..e41d010 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,7 @@ func main() { goCmd := getFlags.String("go", "go", "Path to the go command.") getUpdate := getFlags.Bool("u", false, "The -u flag instructs get to update modules providing dependencies of packages named on the command line to use newer minor or patch releases when available.") getUpdatePatch := getFlags.Bool("upatch", false, "The -upatch flag (not -u patch) also instructs get to update dependencies, but changes the default to select patch releases.") + getInsecure := getFlags.Bool("insecure", false, "Use -insecure flag when using 'go get'") getLink := getFlags.Bool("l", false, "If enabled, bingo will also create soft link called that links to the current"+ "- binary. Use Variables.mk and variables.env if you want to be sure that what you are invoking is what is pinned.") diff --git a/pkg/bingo/mod.go b/pkg/bingo/mod.go index ed578c2..f2f6fb9 100644 --- a/pkg/bingo/mod.go +++ b/pkg/bingo/mod.go @@ -13,6 +13,7 @@ import ( "sort" "strings" + "github.com/bwplotka/bingo/pkg/envars" "github.com/bwplotka/bingo/pkg/runner" "github.com/efficientgo/tools/core/pkg/errcapture" "github.com/efficientgo/tools/core/pkg/merrors" @@ -46,6 +47,11 @@ type Package struct { // Empty if the module is a full package path. // If Module.Path is empty and RelPath specified, it means that we don't know what is a module what is the package path. RelPath string + + // BuildEnvs are environment variables to be used during go build process. + BuildEnvs envars.EnvSlice + // BuildFlags are flags to be used during go build process. + BuildFlags []string } // String returns a representation of the Package suitable for `go` tools and logging. @@ -223,7 +229,7 @@ func (mf *ModFile) Reload() (err error) { mf.directPackage = &Package{Module: r.Mod} if len(r.Syntax.Suffix) > 0 { - mf.directPackage.RelPath = strings.Trim(r.Syntax.Suffix[0].Token[3:], "\n") + mf.directPackage.RelPath, mf.directPackage.BuildEnvs, mf.directPackage.BuildFlags = parseDirectPackageMeta(strings.Trim(r.Syntax.Suffix[0].Token[3:], "\n")) } break } @@ -235,6 +241,27 @@ func (mf *ModFile) Reload() (err error) { return nil } +func parseDirectPackageMeta(line string) (relPath string, buildEnv []string, buildFlags []string) { + elem := strings.Split(line, " ") + for i, l := range elem { + if l == "" { + continue + } + + if l[0] == '-' { + buildFlags = elem[i:] + break + } + + if !strings.Contains(l, "=") { + relPath = l + continue + } + buildEnv = append(buildEnv, l) + } + return relPath, buildEnv, buildFlags +} + func (mf *ModFile) DirectPackage() *Package { return mf.directPackage } @@ -260,11 +287,19 @@ func (mf *ModFile) SetDirectRequire(target Package) (err error) { mf.dropAllRequire() mf.m.AddNewRequire(target.Module.Path, target.Module.Version, false) + var meta []string // Add sub package info if needed. if target.RelPath != "" && target.RelPath != "." { + meta = append(meta, target.RelPath) + } + meta = append(meta, target.BuildEnvs...) + meta = append(meta, target.BuildFlags...) + + if len(meta) > 0 { r := mf.m.Require[0] - r.Syntax.Suffix = append(r.Syntax.Suffix[:0], modfile.Comment{Suffix: true, Token: "// " + target.RelPath}) + r.Syntax.Suffix = append(r.Syntax.Suffix[:0], modfile.Comment{Suffix: true, Token: "// " + strings.Join(meta, " ")}) } + mf.m.Cleanup() mf.directPackage = &target return nil @@ -333,7 +368,7 @@ func ModDirectPackage(modFile string) (pkg Package, err error) { return *mf.directPackage, nil } -// ModIndirectPackage return the all indirect mod from any module file. +// ModIndirectModules return the all indirect mod from any module file. func ModIndirectModules(modFile string) (mods []module.Version, err error) { m, err := ParseModFileOrReader(modFile, nil) if err != nil { @@ -390,6 +425,9 @@ type PackageRenderable struct { PackagePath string EnvVarName string Versions []PackageVersionRenderable + + BuildFlags []string + BuildEnvVars []string } func (p PackageRenderable) ToPackages() []Package { @@ -457,6 +495,9 @@ ModLoop: Versions: []PackageVersionRenderable{ {Version: pkg.Module.Version, ModFile: filepath.Base(f)}, }, + BuildFlags: pkg.BuildFlags, + BuildEnvVars: pkg.BuildEnvs, + EnvVarName: varName, PackagePath: pkg.Path(), ModPath: pkg.Module.Path, diff --git a/pkg/bingo/mod_test.go b/pkg/bingo/mod_test.go index ae5a773..eb70a78 100644 --- a/pkg/bingo/mod_test.go +++ b/pkg/bingo/mod_test.go @@ -116,8 +116,9 @@ func TestModFile(t *testing.T) { testutil.Ok(t, err) t.Cleanup(func() { testutil.Ok(t, os.RemoveAll(tmpDir)) }) - testFile := filepath.Join(tmpDir, "test.mod") - testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + t.Run("with autoreplace", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT go 1.14 @@ -143,15 +144,17 @@ replace ( require github.com/prometheus/prometheus v2.4.3+incompatible // cmd/prometheus `), os.ModePerm)) - mf, err := OpenModFile(testFile) - testutil.Ok(t, err) + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) - testutil.Equals(t, true, mf.AutoReplaceDisabled()) - testutil.Equals(t, Package{Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, RelPath: "cmd/prometheus"}, *mf.DirectPackage()) - testutil.Equals(t, testFile, mf.FileName()) + testutil.Equals(t, true, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, RelPath: "cmd/prometheus"}, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) - testFile2 := filepath.Join(tmpDir, "test.mod2") - testutil.Ok(t, ioutil.WriteFile(testFile2, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + t.Run("without autoreplace", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT go 1.14 @@ -175,10 +178,95 @@ replace ( require github.com/prometheus/prometheus v2.4.3+incompatible // cmd/prometheus `), os.ModePerm)) - mf, err = OpenModFile(testFile2) - testutil.Ok(t, err) + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) + + testutil.Equals(t, false, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, RelPath: "cmd/prometheus"}, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) + + t.Run("with build attributes1", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/prometheus/prometheus v2.4.3+incompatible // cmd/prometheus -tags=yolo,linux +`), os.ModePerm)) + + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) + + testutil.Equals(t, false, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{ + Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, + RelPath: "cmd/prometheus", + BuildFlags: []string{"-tags=yolo,linux"}, + }, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) + + t.Run("with build attributes2", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/prometheus/prometheus v2.4.3+incompatible // cmd/prometheus CGO_ENABLED=1 GOWASM=somefeature +`), os.ModePerm)) - testutil.Equals(t, false, mf.AutoReplaceDisabled()) - testutil.Equals(t, Package{Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, RelPath: "cmd/prometheus"}, *mf.DirectPackage()) - testutil.Equals(t, testFile2, mf.FileName()) + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) + + testutil.Equals(t, false, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{ + Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, + RelPath: "cmd/prometheus", + BuildEnvs: []string{"CGO_ENABLED=1", "GOWASM=somefeature"}, + }, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) + + t.Run("with build attributes3", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/prometheus/prometheus v2.4.3+incompatible // cmd/prometheus CGO_ENABLED=1 GOWASM=somefeature -tags=yolo,linux +`), os.ModePerm)) + + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) + + testutil.Equals(t, false, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{ + Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, + RelPath: "cmd/prometheus", + BuildEnvs: []string{"CGO_ENABLED=1", "GOWASM=somefeature"}, + BuildFlags: []string{"-tags=yolo,linux"}, + }, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) + t.Run("with build attributes without relpath", func(t *testing.T) { + testFile := filepath.Join(tmpDir, "test.mod") + testutil.Ok(t, ioutil.WriteFile(testFile, []byte(`module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/prometheus/prometheus v2.4.3+incompatible // CGO_ENABLED=1 GOWASM=somefeature -tags=yolo,linux +`), os.ModePerm)) + + mf, err := OpenModFile(testFile) + testutil.Ok(t, err) + + testutil.Equals(t, false, mf.AutoReplaceDisabled()) + testutil.Equals(t, Package{ + Module: module.Version{Path: "github.com/prometheus/prometheus", Version: "v2.4.3+incompatible"}, + BuildEnvs: []string{"CGO_ENABLED=1", "GOWASM=somefeature"}, + BuildFlags: []string{"-tags=yolo,linux"}, + }, *mf.DirectPackage()) + testutil.Equals(t, testFile, mf.FileName()) + }) } diff --git a/pkg/bingo/test.mod b/pkg/bingo/test.mod index 7eb9d94..27a0419 100644 --- a/pkg/bingo/test.mod +++ b/pkg/bingo/test.mod @@ -1,3 +1,3 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.15 +go 1.16 diff --git a/pkg/bingo/test2.mod b/pkg/bingo/test2.mod index 7eb9d94..27a0419 100644 --- a/pkg/bingo/test2.mod +++ b/pkg/bingo/test2.mod @@ -1,3 +1,3 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.15 +go 1.16 diff --git a/pkg/bingo/test3.mod b/pkg/bingo/test3.mod index a20a352..3dfeffd 100644 --- a/pkg/bingo/test3.mod +++ b/pkg/bingo/test3.mod @@ -1,5 +1,5 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.15 +go 1.16 require github.com/yolo/best/v100 v100.0.0 // thebest diff --git a/pkg/bingo/test4.mod b/pkg/bingo/test4.mod index 7ad20a1..f01eed5 100644 --- a/pkg/bingo/test4.mod +++ b/pkg/bingo/test4.mod @@ -1,5 +1,5 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.15 +go 1.16 require github.com/yolo/best/v100 v100.0.0 diff --git a/pkg/bingo/test5.mod b/pkg/bingo/test5.mod index 3e93076..0d9b2a4 100644 --- a/pkg/bingo/test5.mod +++ b/pkg/bingo/test5.mod @@ -1,5 +1,5 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.15 +go 1.16 require github.com/yolo/not-best v1 diff --git a/pkg/bingo/variables.go b/pkg/bingo/variables.go index f79bbe0..341ab4a 100644 --- a/pkg/bingo/variables.go +++ b/pkg/bingo/variables.go @@ -32,7 +32,7 @@ $({{ $p.EnvVarName }}):{{- range $p.Versions }} $(BINGO_DIR)/{{ .ModFile }}{{- e @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. {{- range $p.Versions }} @echo "(re)installing $(GOBIN)/{{ $p.Name }}-{{ .Version }}" - @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile={{ .ModFile }} -o=$(GOBIN)/{{ $p.Name }}-{{ .Version }} "{{ $p.PackagePath }}" + @cd $(BINGO_DIR) && {{ range $p.BuildEnvVars }}{{ . }} {{ end }}$(GO) build {{ range $p.BuildFlags }}{{ . }} {{ end }}-mod=mod -modfile={{ .ModFile }} -o=$(GOBIN)/{{ $p.Name }}-{{ .Version }} "{{ $p.PackagePath }}" {{- end }} {{ end}} `, diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 05a9b3b..101f9a5 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -16,6 +16,7 @@ import ( "strings" "github.com/Masterminds/semver" + "github.com/bwplotka/bingo/pkg/envars" "github.com/bwplotka/bingo/pkg/version" "github.com/pkg/errors" ) @@ -63,7 +64,7 @@ func NewRunner(ctx context.Context, logger *log.Logger, insecure bool, goCmd str logger: logger, } - if err := r.execGo(ctx, output, "", "", "version"); err != nil { + if err := r.execGo(ctx, output, nil, "", "", "version"); err != nil { return nil, errors.Wrap(err, "exec go to detect the version") } @@ -92,7 +93,7 @@ var cmdsSupportingModFileArg = map[string]struct{}{ "build": {}, } -func (r *Runner) execGo(ctx context.Context, output io.Writer, cd string, modFile string, args ...string) error { +func (r *Runner) execGo(ctx context.Context, output io.Writer, e envars.EnvSlice, cd string, modFile string, args ...string) error { if modFile != "" { for i, arg := range args { if _, ok := cmdsSupportingModFileArg[arg]; ok { @@ -105,14 +106,16 @@ func (r *Runner) execGo(ctx context.Context, output io.Writer, cd string, modFil } } } - return r.exec(ctx, output, cd, r.goCmd, args...) + return r.exec(ctx, output, e, cd, r.goCmd, args...) } -func (r *Runner) exec(ctx context.Context, output io.Writer, cd string, command string, args ...string) error { +func (r *Runner) exec(ctx context.Context, output io.Writer, e envars.EnvSlice, cd string, command string, args ...string) error { cmd := exec.CommandContext(ctx, command, args...) cmd.Dir = filepath.Join(cmd.Dir, cd) // TODO(bwplotka): Might be surprising, let's return err when this env variable is altered. - cmd.Env = append(os.Environ(), "GO111MODULE=on") + e = envars.MergeEnvSlices(os.Environ(), e...) + e.Set("GO111MODULE=on") + cmd.Env = e cmd.Stdout = output cmd.Stderr = output if err := cmd.Run(); err != nil { @@ -134,7 +137,7 @@ type Runnable interface { GoVersion() *semver.Version List(update GetUpdatePolicy, args ...string) (string, error) GetD(update GetUpdatePolicy, packages ...string) (string, error) - Build(pkg, out string) error + Build(pkg, out string, args ...string) error GoEnv(args ...string) (string, error) ModDownload() error } @@ -142,27 +145,29 @@ type Runnable interface { type runnable struct { r *Runner - ctx context.Context - modFile string - dir string + ctx context.Context + modFile string + dir string + extraEnvVars envars.EnvSlice } // ModInit runs `go mod init` against separate go modules files if any. func (r *Runner) ModInit(ctx context.Context, cd, modFile, moduleName string) error { out := &bytes.Buffer{} - if err := r.execGo(ctx, out, cd, modFile, append([]string{"mod", "init"}, moduleName)...); err != nil { + if err := r.execGo(ctx, out, nil, cd, modFile, append([]string{"mod", "init"}, moduleName)...); err != nil { return errors.Wrap(err, out.String()) } return nil } -// With returns runner that will be ran against give modFile (if any) and in given directory (if any). -func (r *Runner) With(ctx context.Context, modFile string, dir string) Runnable { +// With returns runner that will be ran against give modFile (if any), in given directory (if any), with given extraEnvVars on top of Environ. +func (r *Runner) With(ctx context.Context, modFile string, dir string, extraEnvVars envars.EnvSlice) Runnable { ru := &runnable{ - r: r, - modFile: modFile, - dir: dir, - ctx: ctx, + r: r, + modFile: modFile, + dir: dir, + extraEnvVars: extraEnvVars, + ctx: ctx, } return ru } @@ -186,7 +191,7 @@ func (r *runnable) List(update GetUpdatePolicy, args ...string) (string, error) a = append(a, string(update)) } out := &bytes.Buffer{} - if err := r.r.execGo(r.ctx, out, r.dir, r.modFile, append(a, args...)...); err != nil { + if err := r.r.execGo(r.ctx, out, r.extraEnvVars, r.dir, r.modFile, append(a, args...)...); err != nil { return "", errors.Wrap(err, out.String()) } return strings.Trim(out.String(), "\n"), nil @@ -195,7 +200,7 @@ func (r *runnable) List(update GetUpdatePolicy, args ...string) (string, error) // GoEnv runs `go env` with given args. func (r *runnable) GoEnv(args ...string) (string, error) { out := &bytes.Buffer{} - if err := r.r.execGo(r.ctx, out, r.dir, "", append([]string{"env"}, args...)...); err != nil { + if err := r.r.execGo(r.ctx, out, r.extraEnvVars, r.dir, "", append([]string{"env"}, args...)...); err != nil { return "", errors.Wrap(err, out.String()) } return strings.Trim(out.String(), "\n"), nil @@ -212,16 +217,17 @@ func (r *runnable) GetD(update GetUpdatePolicy, packages ...string) (string, err } out := &bytes.Buffer{} - if err := r.r.execGo(r.ctx, out, r.dir, r.modFile, append(args, packages...)...); err != nil { + if err := r.r.execGo(r.ctx, out, r.extraEnvVars, r.dir, r.modFile, append(args, packages...)...); err != nil { return "", errors.Wrap(err, out.String()) } return strings.Trim(out.String(), "\n"), nil } // Build runs 'go build' against separate go modules file with given packages. -func (r *runnable) Build(pkg, out string) error { +func (r *runnable) Build(pkg, out string, args ...string) error { + args = append([]string{"build", "-o=" + out}, args...) output := &bytes.Buffer{} - if err := r.r.execGo(r.ctx, output, r.dir, r.modFile, append([]string{"build", "-o=" + out}, pkg)...); err != nil { + if err := r.r.execGo(r.ctx, output, r.extraEnvVars, r.dir, r.modFile, append(args, pkg)...); err != nil { return errors.Wrap(err, output.String()) } @@ -241,7 +247,7 @@ func (r *runnable) ModDownload() error { args = append(args, fmt.Sprintf("-modfile=%s", r.modFile)) out := &bytes.Buffer{} - if err := r.r.execGo(r.ctx, out, r.dir, r.modFile, args...); err != nil { + if err := r.r.execGo(r.ctx, out, r.extraEnvVars, r.dir, r.modFile, args...); err != nil { return errors.Wrap(err, out.String()) } diff --git a/pkg/version/version.go b/pkg/version/version.go index 5348810..d4aa63a 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -6,7 +6,7 @@ package version import "github.com/Masterminds/semver" // Version returns 'bingo' version. -const Version = "v0.4.0" +const Version = "v0.4.1" var ( Go114 = semver.MustParse("1.14") diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/.gitignore b/testdata/testproject_with_bingo_v0_4_1/.bingo/.gitignore new file mode 100644 index 0000000..4f2055b --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/.gitignore @@ -0,0 +1,12 @@ + +# Ignore everything +* + +# But not these files: +!.gitignore +!*.mod +!README.md +!Variables.mk +!variables.env + +*tmp.mod diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/README.md b/testdata/testproject_with_bingo_v0_4_1/.bingo/README.md new file mode 100644 index 0000000..7a5c2d4 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/README.md @@ -0,0 +1,14 @@ +# Project Development Dependencies. + +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. + +* Run `bingo get` to install all tools having each own module file in this directory. +* Run `bingo get ` to install that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. +* For go: Import `.bingo/variables.go` to for variable names. +* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. + +## Requirements + +* Go 1.14+ diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/Variables.mk b/testdata/testproject_with_bingo_v0_4_1/.bingo/Variables.mk new file mode 100644 index 0000000..b354de0 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/Variables.mk @@ -0,0 +1,67 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.1. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Below generated variables ensure that every time a tool under each variable is invoked, the correct version +# will be used; reinstalling only if needed. +# For example for buildable variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(BUILDABLE) +# @echo "Running buildable" +# @$(BUILDABLE) +# +BUILDABLE := $(GOBIN)/buildable-v0.0.0-20210109094001-375d0606849d +$(BUILDABLE): $(BINGO_DIR)/buildable.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/buildable-v0.0.0-20210109094001-375d0606849d" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buildable.mod -o=$(GOBIN)/buildable-v0.0.0-20210109094001-375d0606849d "github.com/bwplotka/bingo/testdata/module/buildable" + +BUILDABLE2 := $(GOBIN)/buildable2-v0.0.0-20210109093942-2e6391144e85 +$(BUILDABLE2): $(BINGO_DIR)/buildable2.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/buildable2-v0.0.0-20210109093942-2e6391144e85" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buildable2.mod -o=$(GOBIN)/buildable2-v0.0.0-20210109093942-2e6391144e85 "github.com/bwplotka/bingo/testdata/module/buildable2" + +BUILDABLE_OLD := $(GOBIN)/buildable_old-v0.0.0-20210109093942-2e6391144e85 +$(BUILDABLE_OLD): $(BINGO_DIR)/buildable_old.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/buildable_old-v0.0.0-20210109093942-2e6391144e85" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buildable_old.mod -o=$(GOBIN)/buildable_old-v0.0.0-20210109093942-2e6391144e85 "github.com/bwplotka/bingo/testdata/module/buildable" + +F2_ARRAY := $(GOBIN)/f2-v1.5.0 $(GOBIN)/f2-v1.1.0 $(GOBIN)/f2-v1.2.0 $(GOBIN)/f2-v1.0.0 +$(F2_ARRAY): $(BINGO_DIR)/f2.mod $(BINGO_DIR)/f2.1.mod $(BINGO_DIR)/f2.2.mod $(BINGO_DIR)/f2.3.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/f2-v1.5.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=f2.mod -o=$(GOBIN)/f2-v1.5.0 "github.com/fatih/faillint" + @echo "(re)installing $(GOBIN)/f2-v1.1.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=f2.1.mod -o=$(GOBIN)/f2-v1.1.0 "github.com/fatih/faillint" + @echo "(re)installing $(GOBIN)/f2-v1.2.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=f2.2.mod -o=$(GOBIN)/f2-v1.2.0 "github.com/fatih/faillint" + @echo "(re)installing $(GOBIN)/f2-v1.0.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=f2.3.mod -o=$(GOBIN)/f2-v1.0.0 "github.com/fatih/faillint" + +FAILLINT := $(GOBIN)/faillint-v1.3.0 +$(FAILLINT): $(BINGO_DIR)/faillint.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/faillint-v1.3.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=faillint.mod -o=$(GOBIN)/faillint-v1.3.0 "github.com/fatih/faillint" + +GO_BINDATA := $(GOBIN)/go-bindata-v3.1.1+incompatible +$(GO_BINDATA): $(BINGO_DIR)/go-bindata.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/go-bindata-v3.1.1+incompatible" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=go-bindata.mod -o=$(GOBIN)/go-bindata-v3.1.1+incompatible "github.com/go-bindata/go-bindata/go-bindata" + +WR_BUILDABLE := $(GOBIN)/wr_buildable-v0.0.0-20210109165512-ccbd4039b94a +$(WR_BUILDABLE): $(BINGO_DIR)/wr_buildable.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/wr_buildable-v0.0.0-20210109165512-ccbd4039b94a" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=wr_buildable.mod -o=$(GOBIN)/wr_buildable-v0.0.0-20210109165512-ccbd4039b94a "github.com/bwplotka/bingo/testdata/module_with_replace/buildable" + diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable.mod new file mode 100644 index 0000000..1b2c9bf --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/bwplotka/bingo/testdata/module v0.0.0-20210109094001-375d0606849d // buildable diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable2.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable2.mod new file mode 100644 index 0000000..f46a81c --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/bwplotka/bingo/testdata/module v0.0.0-20210109093942-2e6391144e85 // buildable2 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable_old.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable_old.mod new file mode 100644 index 0000000..4a9de2b --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/buildable_old.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/bwplotka/bingo/testdata/module v0.0.0-20210109093942-2e6391144e85 // buildable diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.1.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.1.mod new file mode 100644 index 0000000..97b0929 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.1.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/fatih/faillint v1.1.0 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.2.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.2.mod new file mode 100644 index 0000000..e384eac --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/fatih/faillint v1.2.0 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.3.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.3.mod new file mode 100644 index 0000000..a169d91 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.3.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/fatih/faillint v1.0.0 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.mod new file mode 100644 index 0000000..d9fcad1 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/f2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/fatih/faillint v1.5.0 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod new file mode 100644 index 0000000..acb7811 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/fatih/faillint v1.3.0 diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/go-bindata.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/go-bindata.mod new file mode 100644 index 0000000..4f79d57 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/go-bindata.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/go-bindata/go-bindata v3.1.1+incompatible // go-bindata diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/go.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/go.mod new file mode 100644 index 0000000..610249a --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/go.mod @@ -0,0 +1 @@ +module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. \ No newline at end of file diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/variables.env b/testdata/testproject_with_bingo_v0_4_1/.bingo/variables.env new file mode 100644 index 0000000..30e29a6 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/variables.env @@ -0,0 +1,24 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.1. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. +GOBIN=${GOBIN:=$(go env GOBIN)} + +if [ -z "$GOBIN" ]; then + GOBIN="$(go env GOPATH)/bin" +fi + + +BUILDABLE="${GOBIN}/buildable-v0.0.0-20210109094001-375d0606849d" + +BUILDABLE2="${GOBIN}/buildable2-v0.0.0-20210109093942-2e6391144e85" + +BUILDABLE_OLD="${GOBIN}/buildable_old-v0.0.0-20210109093942-2e6391144e85" + +F2_ARRAY="${GOBIN}/f2-v1.5.0 ${GOBIN}/f2-v1.1.0 ${GOBIN}/f2-v1.2.0 ${GOBIN}/f2-v1.0.0" + +FAILLINT="${GOBIN}/faillint-v1.3.0" + +GO_BINDATA="${GOBIN}/go-bindata-v3.1.1+incompatible" + +WR_BUILDABLE="${GOBIN}/wr_buildable-v0.0.0-20210109165512-ccbd4039b94a" + diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/wr_buildable.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/wr_buildable.mod new file mode 100644 index 0000000..29eda26 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/wr_buildable.mod @@ -0,0 +1,7 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +replace github.com/bwplotka/bingo => github.com/pkg/errors v0.9.1 + +require github.com/bwplotka/bingo/testdata/module_with_replace v0.0.0-20210109165512-ccbd4039b94a // buildable