From fcb44c0f91f384048685591c9d4f014b583e8535 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Thu, 13 May 2021 18:50:46 +0200 Subject: [PATCH] Fixed pinned build envvar/flag support + list. Signed-off-by: Bartlomiej Plotka --- CHANGELOG.md | 15 ++- README.md | 3 + get.go | 7 +- get_e2e_test.go | 96 ++++++++++++++----- main.go | 25 +---- pkg/bingo/mod.go | 40 +++++++- pkg/version/version.go | 2 +- .../.bingo/faillint.mod | 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 ++ 23 files changed, 304 insertions(+), 56 deletions(-) create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/.gitignore create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/README.md create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/Variables.mk create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/buildable.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/buildable2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/buildable_old.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/f2.1.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/f2.2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/f2.3.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/f2.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/faillint.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/go-bindata.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/go.mod create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/variables.env create mode 100644 testdata/testproject_with_bingo_v0_4_2/.bingo/wr_buildable.mod diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af7f38..1001beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,24 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) -## (Under development) +## Unreleased + +## [v0.4.2](https://github.com/bwplotka/bingo/releases/tag/v0.4.2) - 2021.05.13 + +### Added + +* bingo list now lists pinned build flags and environment variables. + +### Fixed + +* Fixed preserving build flags and env files via bingo .mod files. +* Fixed formatting of bingo list ## [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. +* Added support for build flags and environment variables via go.mod file. ### Fixed diff --git a/README.md b/README.md index 95eb2bf..825deb1 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,9 @@ go 1.16 require github.com/gohugoio/hugo v0.83.1 // CGO_ENABLED=1 -tags=extended ``` +Run `bingo list` to see if build options are parsed correctly. +Run `bingo get` to install all binaries including the modified one with new build flags. + ## Production Usage To see production example see: diff --git a/get.go b/get.go index 2756095..10f0917 100644 --- a/get.go +++ b/get.go @@ -280,8 +280,6 @@ 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() @@ -583,6 +581,11 @@ func getPackage(ctx context.Context, logger *log.Logger, c installPackageConfig, } } + // Currently user can't specify build flags and envvars from CLI, take if from optionally, manually updated mod file. + if old := tmpModFile.DirectPackage(); old != nil { + target.BuildEnvs = old.BuildEnvs + target.BuildFlags = old.BuildFlags + } if err := tmpModFile.SetDirectRequire(target); err != nil { return err } diff --git a/get_e2e_test.go b/get_e2e_test.go index b9e1745..78c7f61 100644 --- a/get_e2e_test.go +++ b/get_e2e_test.go @@ -11,6 +11,7 @@ import ( "strings" "testing" + "github.com/bwplotka/bingo/pkg/bingo" "github.com/bwplotka/bingo/pkg/runner" "github.com/bwplotka/bingo/pkg/version" "github.com/efficientgo/tools/core/pkg/testutil" @@ -22,18 +23,33 @@ const ( defaultGoProxy = "https://proxy.golang.org" ) -var bingoExpectedCompatibilityOutput = []row{ - {name: "buildable", binName: "buildable-v0.0.0-20210109094001-375d0606849d", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109094001-375d0606849d"}, - {name: "buildable2", binName: "buildable2-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable2@v0.0.0-20210109093942-2e6391144e85"}, - {name: "buildable_old", binName: "buildable_old-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109093942-2e6391144e85"}, - {name: "f2", binName: "f2-v1.0.0", pkgVersion: "github.com/fatih/faillint@v1.0.0"}, - {name: "f2", binName: "f2-v1.1.0", pkgVersion: "github.com/fatih/faillint@v1.1.0"}, - {name: "f2", binName: "f2-v1.2.0", pkgVersion: "github.com/fatih/faillint@v1.2.0"}, - {name: "f2", binName: "f2-v1.5.0", pkgVersion: "github.com/fatih/faillint@v1.5.0"}, - {name: "faillint", binName: "faillint-v1.3.0", pkgVersion: "github.com/fatih/faillint@v1.3.0"}, - {name: "go-bindata", binName: "go-bindata-v3.1.1+incompatible", pkgVersion: "github.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible"}, - {name: "wr_buildable", binName: "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a", pkgVersion: "github.com/bwplotka/bingo/testdata/module_with_replace/buildable@v0.0.0-20210109165512-ccbd4039b94a"}, -} +var ( + bingoExpectedCompatibilityOutput = []row{ + {name: "buildable", binName: "buildable-v0.0.0-20210109094001-375d0606849d", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109094001-375d0606849d"}, + {name: "buildable2", binName: "buildable2-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable2@v0.0.0-20210109093942-2e6391144e85"}, + {name: "buildable_old", binName: "buildable_old-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109093942-2e6391144e85"}, + {name: "f2", binName: "f2-v1.0.0", pkgVersion: "github.com/fatih/faillint@v1.0.0"}, + {name: "f2", binName: "f2-v1.1.0", pkgVersion: "github.com/fatih/faillint@v1.1.0"}, + {name: "f2", binName: "f2-v1.2.0", pkgVersion: "github.com/fatih/faillint@v1.2.0"}, + {name: "f2", binName: "f2-v1.5.0", pkgVersion: "github.com/fatih/faillint@v1.5.0"}, + {name: "faillint", binName: "faillint-v1.3.0", pkgVersion: "github.com/fatih/faillint@v1.3.0"}, + {name: "go-bindata", binName: "go-bindata-v3.1.1+incompatible", pkgVersion: "github.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible"}, + {name: "wr_buildable", binName: "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a", pkgVersion: "github.com/bwplotka/bingo/testdata/module_with_replace/buildable@v0.0.0-20210109165512-ccbd4039b94a"}, + } + + bingoExpectedCompatibilityOutput_0_4_1 = []row{ + {name: "buildable", binName: "buildable-v0.0.0-20210109094001-375d0606849d", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109094001-375d0606849d"}, + {name: "buildable2", binName: "buildable2-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable2@v0.0.0-20210109093942-2e6391144e85"}, + {name: "buildable_old", binName: "buildable_old-v0.0.0-20210109093942-2e6391144e85", pkgVersion: "github.com/bwplotka/bingo/testdata/module/buildable@v0.0.0-20210109093942-2e6391144e85"}, + {name: "f2", binName: "f2-v1.0.0", pkgVersion: "github.com/fatih/faillint@v1.0.0"}, + {name: "f2", binName: "f2-v1.1.0", pkgVersion: "github.com/fatih/faillint@v1.1.0"}, + {name: "f2", binName: "f2-v1.2.0", pkgVersion: "github.com/fatih/faillint@v1.2.0"}, + {name: "f2", binName: "f2-v1.5.0", pkgVersion: "github.com/fatih/faillint@v1.5.0"}, + {name: "faillint", binName: "faillint-v1.3.0", pkgVersion: "github.com/fatih/faillint@v1.3.0", buildEnvVars: "CGO_ENABLED=1", buildFlags: "-tags=extended"}, + {name: "go-bindata", binName: "go-bindata-v3.1.1+incompatible", pkgVersion: "github.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible"}, + {name: "wr_buildable", binName: "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a", pkgVersion: "github.com/bwplotka/bingo/testdata/module_with_replace/buildable@v0.0.0-20210109165512-ccbd4039b94a"}, + } +) // TODO(bwplotka): Test running versions. To do so we might want to setup small binary printing Version at each commit. // $GOBIN has to be set for this test to run properly. @@ -764,6 +780,15 @@ func TestGet(t *testing.T) { for _, dir := range dirs { t.Run(dir, func(t *testing.T) { + compatibilityOutput := bingoExpectedCompatibilityOutput + + // Special test case. failint.mod for v0.4.1 version contains line syntax, allowing go build to add those build flags (which does nothing to failint). + // Yet, check if they will get preserved. + // TODO(bwplotka): Design test module that tests better those edge cases instead of installing different 3rdparty real modules. + if dir == "testdata/testproject_with_bingo_v0_4_1" { + compatibilityOutput = bingoExpectedCompatibilityOutput_0_4_1 + } + for _, isGoProject := range []bool{false, true} { t.Run(fmt.Sprintf("isGoProject=%v", isGoProject), func(t *testing.T) { t.Run("Via bingo get all", func(t *testing.T) { @@ -778,7 +803,7 @@ func TestGet(t *testing.T) { p.assertNotChanged(t, defaultModDir) testutil.Equals(t, []string{}, g.existingBinaries(t)) - expectBingoListRows(t, bingoExpectedCompatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) + expectBingoListRows(t, compatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) defer p.assertNotChanged(t, defaultModDir) @@ -792,7 +817,7 @@ func TestGet(t *testing.T) { "faillint-v1.3.0", "go-bindata-v3.1.1+incompatible", "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a", }, g.existingBinaries(t)) - expectBingoListRows(t, bingoExpectedCompatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) + expectBingoListRows(t, compatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) // Expect binaries works: testutil.Equals(t, "module.buildable 2.1\n", g.ExecOutput(t, p.root, filepath.Join(g.gobin, "buildable-v0.0.0-20210109094001-375d0606849d"))) @@ -830,7 +855,7 @@ func TestGet(t *testing.T) { fmt.Println(g.ExecOutput(t, p.root, goBinPath, "get", "f2")) testutil.Equals(t, []string{"buildable-v0.0.0-20210109094001-375d0606849d", "f2-v1.0.0", "f2-v1.1.0", "f2-v1.2.0", "f2-v1.5.0", "faillint-v1.3.0", "wr_buildable-v0.0.0-20210109165512-ccbd4039b94a"}, g.existingBinaries(t)) - expectBingoListRows(t, bingoExpectedCompatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) + expectBingoListRows(t, compatibilityOutput, g.ExecOutput(t, p.root, goBinPath, "list")) }) t.Run("Via go", func(t *testing.T) { g.Clear(t) @@ -935,7 +960,7 @@ func TestGet(t *testing.T) { fmt.Println(g.ExecOutput(t, p.root, goBinPath, "get", "wr_buildable@none")) fmt.Println(g.ExecOutput(t, p.root, goBinPath, "get", "go-bindata@none")) - testutil.Equals(t, "Name\tBinary Name\tPackage @ Version\n----\t-----------\t-----------------", g.ExecOutput(t, p.root, goBinPath, "list")) + expectBingoListRows(t, nil, g.ExecOutput(t, p.root, goBinPath, "list")) _, err := os.Stat(filepath.Join(p.root, ".bingo", "Variables.mk")) testutil.NotOk(t, err) @@ -949,14 +974,16 @@ func TestGet(t *testing.T) { } type row struct { - name, binName, pkgVersion string + name, binName, pkgVersion, buildEnvVars, buildFlags string } func expectBingoListRows(t testing.TB, expect []row, output string) { t.Helper() - trimmed := strings.TrimLeft(output, "Name\tBinary Name\tPackage @ Version\n----\t-----------\t-----------------\n") // nolint - var got []row + var ( + trimmed = strings.TrimLeft(output, bingo.PackageRenderablesPrintHeader) + got []row + ) for _, line := range strings.Split(trimmed, "\n") { s := strings.Fields(line) if len(s) == 0 { @@ -969,6 +996,12 @@ func expectBingoListRows(t testing.TB, expect []row, output string) { if len(s) > 2 { r.pkgVersion = s[2] } + if len(s) > 3 { + r.buildEnvVars = s[3] + } + if len(s) > 4 { + r.buildFlags = s[4] + } got = append(got, r) } testutil.Equals(t, expect, got) @@ -976,10 +1009,23 @@ func expectBingoListRows(t testing.TB, expect []row, output string) { func TestExpectBingoListRows(t *testing.T) { expectBingoListRows(t, []row{ - {name: "f4", binName: "f4-v1.1.0", pkgVersion: "github.com/fatih/faillint@v1.1.0"}, - {name: "faillint", binName: "faillint-v1.1.0", pkgVersion: "github.com/fatih/faillint@v1.1.0"}, - {name: "faillint", binName: "faillint-v1.0.0", pkgVersion: "github.com/fatih/faillint@v1.0.0"}, - {name: "go-bindata", binName: "go-bindata-v3.1.1+incompatible", pkgVersion: "github.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible"}, - {name: "goimports", binName: "goimports-v0.0.0-20200522201501-cb1345f3a375", pkgVersion: "golang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375"}, - }, "Name\t\t\tBinary Name\t\t\t\t\t\t\tPackage @ Version\n----\t\t\t-----------\t\t\t\t\t\t\t-----------------\nf4\t\t\tf4-v1.1.0\t\t\t\t\t\t\t\tgithub.com/fatih/faillint@v1.1.0\t\t\t\t\t\t\t\nfaillint\t\tfaillint-v1.1.0\t\t\t\t\t\tgithub.com/fatih/faillint@v1.1.0\t\t\t\t\t\t\t\nfaillint\t\tfaillint-v1.0.0\t\t\t\t\t\tgithub.com/fatih/faillint@v1.0.0\t\t\t\t\t\t\t\ngo-bindata\tgo-bindata-v3.1.1+incompatible\t\t\tgithub.com/go-bindata/go-bindata/go-bindata@v3.1.1+incompatible\t\ngoimports\t\tgoimports-v0.0.0-20200522201501-cb1345f3a375\tgolang.org/x/tools/cmd/goimports@v0.0.0-20200522201501-cb1345f3a375") + {name: "pyright", binName: "copyright-v0.0.0-20210112004814-138d5e5695fe", pkgVersion: "github.com/efficientgo/tools/copyright@v0.0.0-20210112004814-138d5e5695fe"}, + {name: "embedmd", binName: "embedmd-v1.0.0", pkgVersion: "github.com/campoy/embedmd@v1.0.0", buildEnvVars: "CGO_ENABLED=1", buildFlags: "-tags=lol"}, + {name: "faillint", binName: "faillint-v1.5.0", pkgVersion: "github.com/fatih/faillint@v1.5.0"}, + {name: "goimports", binName: "goimports-v0.0.0-20210112230658-8b4aab62c064", pkgVersion: "golang.org/x/tools/cmd/goimports@v0.0.0-20210112230658-8b4aab62c064"}, + {name: "golangci-lint", binName: "golangci-lint-v1.26.0", pkgVersion: "github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0"}, + {name: "mdox", binName: "mdox-v0.2.1", pkgVersion: "github.com/bwplotka/mdox@v0.2.1"}, + {name: "misspell", binName: "misspell-v0.3.4", pkgVersion: "github.com/client9/misspell/cmd/misspell@v0.3.4"}, + {name: "proxy", binName: "proxy-v0.10.0", pkgVersion: "github.com/gomods/athens/cmd/proxy@v0.10.0"}, + }, `Name Binary Name Package @ Version Build EnvVars Build Flags +---- ----------- ----------------- ------------- ----------- +copyright copyright-v0.0.0-20210112004814-138d5e5695fe github.com/efficientgo/tools/copyright@v0.0.0-20210112004814-138d5e5695fe +embedmd embedmd-v1.0.0 github.com/campoy/embedmd@v1.0.0 CGO_ENABLED=1 -tags=lol +faillint faillint-v1.5.0 github.com/fatih/faillint@v1.5.0 +goimports goimports-v0.0.0-20210112230658-8b4aab62c064 golang.org/x/tools/cmd/goimports@v0.0.0-20210112230658-8b4aab62c064 +golangci-lint golangci-lint-v1.26.0 github.com/golangci/golangci-lint/cmd/golangci-lint@v1.26.0 +mdox mdox-v0.2.1 github.com/bwplotka/mdox@v0.2.1 +misspell misspell-v0.3.4 github.com/client9/misspell/cmd/misspell@v0.3.4 +proxy proxy-v0.10.0 github.com/gomods/athens/cmd/proxy@v0.10.0 +`) } diff --git a/main.go b/main.go index e41d010..236cc10 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,6 @@ import ( "regexp" "strings" "syscall" - "text/tabwriter" "github.com/bwplotka/bingo/pkg/bingo" "github.com/bwplotka/bingo/pkg/runner" @@ -197,29 +196,7 @@ func main() { } bingo.SortRenderables(pkgs) - - w := new(tabwriter.Writer) - w.Init(os.Stdout, 4, 4, 1, '\t', 0) - defer func() { _ = w.Flush() }() - - _, _ = fmt.Fprintf(w, "Name\tBinary Name\tPackage @ Version") - _, _ = fmt.Fprintf(w, "\n----\t-----------\t-----------------") - for _, p := range pkgs { - if target != "" && p.Name != target { - continue - } - for _, v := range p.Versions { - _, _ = fmt.Fprintf(w, "\n%s\t%s-%s\t%s@%s", p.Name, p.Name, v.Version, p.PackagePath, v.Version) - } - if target != "" { - return nil - } - } - - if target != "" { - return errors.Errorf("Pinned tool %s not found", target) - } - return nil + return pkgs.PrintTab(target, os.Stdout) } case "version": cmdFunc = func(ctx context.Context, r *runner.Runner) error { diff --git a/pkg/bingo/mod.go b/pkg/bingo/mod.go index f2f6fb9..1c307a9 100644 --- a/pkg/bingo/mod.go +++ b/pkg/bingo/mod.go @@ -5,6 +5,7 @@ package bingo import ( "context" + "fmt" "io" "io/ioutil" "log" @@ -12,6 +13,7 @@ import ( "path/filepath" "sort" "strings" + "text/tabwriter" "github.com/bwplotka/bingo/pkg/envars" "github.com/bwplotka/bingo/pkg/runner" @@ -27,6 +29,9 @@ const ( FakeRootModFileName = "go.mod" NoReplaceCommand = "bingo:no_replace_fetch" + + PackageRenderablesPrintHeader = "Name\tBinary Name\tPackage @ Version\tBuild EnvVars\tBuild Flags\n" + + "----\t-----------\t-----------------\t-------------\t-----------\n" ) // NameFromModFile returns binary name from module file path. @@ -446,8 +451,41 @@ func (p PackageRenderable) ToPackages() []Package { return ret } +type PackageRenderables []PackageRenderable + +func (pkgs PackageRenderables) PrintTab(target string, w io.Writer) error { + tw := new(tabwriter.Writer) + tw.Init(w, 1, 8, 1, '\t', tabwriter.AlignRight) + defer func() { _ = tw.Flush() }() + + _, _ = fmt.Fprint(tw, PackageRenderablesPrintHeader) + for _, p := range pkgs { + if target != "" && p.Name != target { + continue + } + for _, v := range p.Versions { + fields := []string{ + p.Name, + p.Name + "-" + v.Version, + p.PackagePath + "@" + v.Version, + strings.Join(p.BuildEnvVars, " "), + strings.Join(p.BuildFlags, " "), + } + _, _ = fmt.Fprintln(tw, strings.Join(fields, "\t")) + } + if target != "" { + return nil + } + } + + if target != "" { + return errors.Errorf("Pinned tool %s not found", target) + } + return nil +} + // ListPinnedMainPackages lists all bingo pinned binaries (Go main packages) in the same order as seen in the filesystem. -func ListPinnedMainPackages(logger *log.Logger, modDir string, remMalformed bool) (pkgs []PackageRenderable, _ error) { +func ListPinnedMainPackages(logger *log.Logger, modDir string, remMalformed bool) (pkgs PackageRenderables, _ error) { modFiles, err := filepath.Glob(filepath.Join(modDir, "*.mod")) if err != nil { return nil, err diff --git a/pkg/version/version.go b/pkg/version/version.go index d4aa63a..1f72e4a 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.1" +const Version = "v0.4.2" var ( Go114 = semver.MustParse("1.14") diff --git a/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod b/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod index acb7811..66b8d36 100644 --- a/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod +++ b/testdata/testproject_with_bingo_v0_4_1/.bingo/faillint.mod @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT go 1.16 -require github.com/fatih/faillint v1.3.0 +require github.com/fatih/faillint v1.3.0 // CGO_ENABLED=1 -tags=extended diff --git a/testdata/testproject_with_bingo_v0_4_2/.bingo/.gitignore b/testdata/testproject_with_bingo_v0_4_2/.bingo/.gitignore new file mode 100644 index 0000000..4f2055b --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/README.md b/testdata/testproject_with_bingo_v0_4_2/.bingo/README.md new file mode 100644 index 0000000..7a5c2d4 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/Variables.mk b/testdata/testproject_with_bingo_v0_4_2/.bingo/Variables.mk new file mode 100644 index 0000000..a62a795 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.bingo/Variables.mk @@ -0,0 +1,67 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.2. 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_2/.bingo/buildable.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/buildable.mod new file mode 100644 index 0000000..1b2c9bf --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/buildable2.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/buildable2.mod new file mode 100644 index 0000000..f46a81c --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/buildable_old.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/buildable_old.mod new file mode 100644 index 0000000..4a9de2b --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/f2.1.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/f2.1.mod new file mode 100644 index 0000000..97b0929 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/f2.2.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/f2.2.mod new file mode 100644 index 0000000..e384eac --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/f2.3.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/f2.3.mod new file mode 100644 index 0000000..a169d91 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/f2.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/f2.mod new file mode 100644 index 0000000..d9fcad1 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/faillint.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/faillint.mod new file mode 100644 index 0000000..acb7811 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/go-bindata.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/go-bindata.mod new file mode 100644 index 0000000..4f79d57 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/go.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/go.mod new file mode 100644 index 0000000..610249a --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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_2/.bingo/variables.env b/testdata/testproject_with_bingo_v0_4_2/.bingo/variables.env new file mode 100644 index 0000000..e051ea0 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.bingo/variables.env @@ -0,0 +1,24 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.2. 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_2/.bingo/wr_buildable.mod b/testdata/testproject_with_bingo_v0_4_2/.bingo/wr_buildable.mod new file mode 100644 index 0000000..29eda26 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_4_2/.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