Skip to content

Commit

Permalink
Pin module download mode to module cache for go build (#44)
Browse files Browse the repository at this point in the history
* Add missing testproject files for release v0.2.3

* Pin module download mode to module cache for go build

Co-authored-by: Periklis Tsirakidis <[email protected]>
  • Loading branch information
periklis and periklis authored Aug 25, 2020
1 parent f188232 commit 223fa25
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/bingo/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
`
Expand Down
12 changes: 12 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Ignore everything
*

# But not these files:
!.gitignore
!*.mod
!README.md
!Variables.mk
!variables.env

*tmp.mod
13 changes: 13 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/README.md
Original file line number Diff line number Diff line change
@@ -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 <tool>` to install <tool> that have own module file in this directory.
* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $(<upper case tool name>) variable where <tool> is the .bingo/<tool>.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+
54 changes: 54 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/Variables.mk
Original file line number Diff line number Diff line change
@@ -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) <flags/args..>
#
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"

5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/f2.1.mod
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/f2.2.mod
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/f2.3.mod
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/f2.mod
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/faillint.mod
Original file line number Diff line number Diff line change
@@ -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
)
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/go-bindata.mod
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/go.mod
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/goimports.mod
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/goimports2.mod
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions testdata/testproject_with_bingo_v0_2_3/.bingo/variables.env
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 223fa25

Please sign in to comment.