From 223fa251ddbdf65c6f30b0b97e4d688a5dc1a171 Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Tue, 25 Aug 2020 13:31:45 +0200 Subject: [PATCH] Pin module download mode to module cache for go build (#44) * Add missing testproject files for release v0.2.3 * Pin module download mode to module cache for go build Co-authored-by: Periklis Tsirakidis --- pkg/bingo/make.go | 2 +- .../.bingo/.gitignore | 12 +++++ .../.bingo/README.md | 13 +++++ .../.bingo/Variables.mk | 54 +++++++++++++++++++ .../.bingo/f2.1.mod | 5 ++ .../.bingo/f2.2.mod | 5 ++ .../.bingo/f2.3.mod | 5 ++ .../.bingo/f2.mod | 5 ++ .../.bingo/faillint.mod | 8 +++ .../.bingo/go-bindata.mod | 5 ++ .../.bingo/go.mod | 1 + .../.bingo/goimports.mod | 5 ++ .../.bingo/goimports2.mod | 5 ++ .../.bingo/variables.env | 20 +++++++ 14 files changed, 144 insertions(+), 1 deletion(-) create mode 100755 testdata/testproject_with_bingo_v0_2_3/.bingo/.gitignore create mode 100755 testdata/testproject_with_bingo_v0_2_3/.bingo/README.md create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/Variables.mk create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/f2.1.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/f2.2.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/f2.3.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/f2.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/faillint.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/go-bindata.mod create mode 100755 testdata/testproject_with_bingo_v0_2_3/.bingo/go.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/goimports.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/goimports2.mod create mode 100644 testdata/testproject_with_bingo_v0_2_3/.bingo/variables.env diff --git a/pkg/bingo/make.go b/pkg/bingo/make.go index 30dd045..a3b4ab7 100644 --- a/pkg/bingo/make.go +++ b/pkg/bingo/make.go @@ -31,7 +31,7 @@ $({{ $p.EnvVarName }}):{{- range $p.Versions }} {{ $.RelModDir }}/{{ .ModFile }} @# 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 {{ $.RelModDir }} && $(GO) build -modfile={{ .ModFile }} -o=$(GOBIN)/{{ $p.Name }}-{{ .Version }} "{{ $p.PackagePath }}" + @cd {{ $.RelModDir }} && $(GO) build -mod=mod -modfile={{ .ModFile }} -o=$(GOBIN)/{{ $p.Name }}-{{ .Version }} "{{ $p.PackagePath }}" {{- end }} {{ end}} ` diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/.gitignore b/testdata/testproject_with_bingo_v0_2_3/.bingo/.gitignore new file mode 100755 index 0000000..4f2055b --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.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_2_3/.bingo/README.md b/testdata/testproject_with_bingo_v0_2_3/.bingo/README.md new file mode 100755 index 0000000..70f9286 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/README.md @@ -0,0 +1,13 @@ +# 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 +* 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_2_3/.bingo/Variables.mk b/testdata/testproject_with_bingo_v0_2_3/.bingo/Variables.mk new file mode 100644 index 0000000..4761bf3 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/Variables.mk @@ -0,0 +1,54 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.3. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Bellow 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 f2 variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(F2_ARRAY) +# @echo "Running f2" +# @$(F2_ARRAY) +# +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/f2.mod .bingo/f2.1.mod .bingo/f2.2.mod .bingo/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 && $(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 && $(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 && $(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 && $(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/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 && $(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/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 && $(GO) build -mod=mod -modfile=go-bindata.mod -o=$(GOBIN)/go-bindata-v3.1.1+incompatible "github.com/go-bindata/go-bindata/go-bindata" + +GOIMPORTS := $(GOBIN)/goimports-v0.0.0-20200522201501-cb1345f3a375 +$(GOIMPORTS): .bingo/goimports.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)/goimports-v0.0.0-20200522201501-cb1345f3a375" + @cd .bingo && $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.0.0-20200522201501-cb1345f3a375 "golang.org/x/tools/cmd/goimports" + +GOIMPORTS2 := $(GOBIN)/goimports2-v0.0.0-20200519175826-7521f6f42533 +$(GOIMPORTS2): .bingo/goimports2.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)/goimports2-v0.0.0-20200519175826-7521f6f42533" + @cd .bingo && $(GO) build -mod=mod -modfile=goimports2.mod -o=$(GOBIN)/goimports2-v0.0.0-20200519175826-7521f6f42533 "golang.org/x/tools/cmd/goimports" + diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.1.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.1.mod new file mode 100644 index 0000000..a86b191 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.1.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/fatih/faillint v1.1.0 diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.2.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.2.mod new file mode 100644 index 0000000..c43054c --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/fatih/faillint v1.2.0 diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.3.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.3.mod new file mode 100644 index 0000000..5a191fc --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.3.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/fatih/faillint v1.0.0 diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.mod new file mode 100644 index 0000000..304af0e --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/f2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/fatih/faillint v1.5.0 diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/faillint.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/faillint.mod new file mode 100644 index 0000000..9f8b2cc --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/faillint.mod @@ -0,0 +1,8 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require ( + dmitri.shuralyov.com/go/generated v0.0.0-20170818220700-b1254a446363 // indirect + github.com/fatih/faillint v1.3.0 +) diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/go-bindata.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/go-bindata.mod new file mode 100644 index 0000000..4ed1983 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/go-bindata.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require github.com/go-bindata/go-bindata v3.1.1+incompatible // go-bindata diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/go.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/go.mod new file mode 100755 index 0000000..610249a --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.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_2_3/.bingo/goimports.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/goimports.mod new file mode 100644 index 0000000..6095e2d --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/goimports.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // cmd/goimports diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/goimports2.mod b/testdata/testproject_with_bingo_v0_2_3/.bingo/goimports2.mod new file mode 100644 index 0000000..1614178 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/goimports2.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.14 + +require golang.org/x/tools v0.0.0-20200519175826-7521f6f42533 // cmd/goimports diff --git a/testdata/testproject_with_bingo_v0_2_3/.bingo/variables.env b/testdata/testproject_with_bingo_v0_2_3/.bingo/variables.env new file mode 100644 index 0000000..c44bb50 --- /dev/null +++ b/testdata/testproject_with_bingo_v0_2_3/.bingo/variables.env @@ -0,0 +1,20 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.3. 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. +local gobin=$(go env GOBIN) + +if [ -z "$gobin" ]; then + gobin="$(go env GOPATH)/bin" +fi + + +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" + +GOIMPORTS="${gobin}/goimports-v0.0.0-20200522201501-cb1345f3a375" + +GOIMPORTS2="${gobin}/goimports2-v0.0.0-20200519175826-7521f6f42533" +