diff --git a/.bingo/.gitignore b/.bingo/.gitignore new file mode 100755 index 0000000..4f2055b --- /dev/null +++ b/.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/.bingo/README.md b/.bingo/README.md new file mode 100755 index 0000000..70f9286 --- /dev/null +++ b/.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/.bingo/Variables.mk b/.bingo/Variables.mk new file mode 100644 index 0000000..9cb7d24 --- /dev/null +++ b/.bingo/Variables.mk @@ -0,0 +1,54 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.2. 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 bingo variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(BINGO) +# @echo "Running bingo" +# @$(BINGO) +# +BINGO := $(GOBIN)/bingo-v0.2.3 +$(BINGO): .bingo/bingo.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)/bingo-v0.2.3" + @cd .bingo && $(GO) build -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.2.3 "github.com/bwplotka/bingo" + +CALENS := $(GOBIN)/calens-v0.2.0 +$(CALENS): .bingo/calens.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)/calens-v0.2.0" + @cd .bingo && $(GO) build -modfile=calens.mod -o=$(GOBIN)/calens-v0.2.0 "github.com/restic/calens" + +GOLINT := $(GOBIN)/golint-v0.0.0-20200302205851-738671d3881b +$(GOLINT): .bingo/golint.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)/golint-v0.0.0-20200302205851-738671d3881b" + @cd .bingo && $(GO) build -modfile=golint.mod -o=$(GOBIN)/golint-v0.0.0-20200302205851-738671d3881b "golang.org/x/lint/golint" + +GOVERAGE := $(GOBIN)/goverage-v0.0.0-20180129164344-eec3514a20b5 +$(GOVERAGE): .bingo/goverage.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)/goverage-v0.0.0-20180129164344-eec3514a20b5" + @cd .bingo && $(GO) build -modfile=goverage.mod -o=$(GOBIN)/goverage-v0.0.0-20180129164344-eec3514a20b5 "github.com/haya14busa/goverage" + +REFLEX := $(GOBIN)/reflex-v0.3.0 +$(REFLEX): .bingo/reflex.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)/reflex-v0.3.0" + @cd .bingo && $(GO) build -modfile=reflex.mod -o=$(GOBIN)/reflex-v0.3.0 "github.com/cespare/reflex" + +STATICCHECK := $(GOBIN)/staticcheck-v0.0.1-2020.1.6 +$(STATICCHECK): .bingo/staticcheck.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)/staticcheck-v0.0.1-2020.1.6" + @cd .bingo && $(GO) build -modfile=staticcheck.mod -o=$(GOBIN)/staticcheck-v0.0.1-2020.1.6 "honnef.co/go/tools/cmd/staticcheck" + diff --git a/.bingo/bingo.mod b/.bingo/bingo.mod new file mode 100644 index 0000000..d34e426 --- /dev/null +++ b/.bingo/bingo.mod @@ -0,0 +1,9 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.15 + +require ( + github.com/bwplotka/bingo v0.2.3 + golang.org/x/mod v0.3.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect +) diff --git a/.bingo/calens.mod b/.bingo/calens.mod new file mode 100644 index 0000000..10fffbf --- /dev/null +++ b/.bingo/calens.mod @@ -0,0 +1,13 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.15 + +require ( + github.com/Masterminds/sprig/v3 v3.1.0 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.11 // indirect + github.com/mitchellh/reflectwalk v1.0.1 // indirect + github.com/restic/calens v0.2.0 + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect +) diff --git a/.bingo/go.mod b/.bingo/go.mod new file mode 100755 index 0000000..610249a --- /dev/null +++ b/.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/.bingo/golint.mod b/.bingo/golint.mod new file mode 100644 index 0000000..204f79f --- /dev/null +++ b/.bingo/golint.mod @@ -0,0 +1,8 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.15 + +require ( + golang.org/x/lint v0.0.0-20200302205851-738671d3881b // golint + golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect +) diff --git a/.bingo/reflex.mod b/.bingo/reflex.mod new file mode 100644 index 0000000..7fc89f5 --- /dev/null +++ b/.bingo/reflex.mod @@ -0,0 +1,9 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.15 + +require ( + github.com/cespare/reflex v0.3.0 + github.com/fsnotify/fsnotify v1.4.9 // indirect + golang.org/x/sys v0.0.0-20201028094953-708e7fb298ac // indirect +) diff --git a/.bingo/staticcheck.mod b/.bingo/staticcheck.mod new file mode 100644 index 0000000..9c964da --- /dev/null +++ b/.bingo/staticcheck.mod @@ -0,0 +1,8 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.15 + +require ( + golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect + honnef.co/go/tools v0.0.1-2020.1.6 // cmd/staticcheck +) diff --git a/.bingo/variables.env b/.bingo/variables.env new file mode 100644 index 0000000..c4da2cd --- /dev/null +++ b/.bingo/variables.env @@ -0,0 +1,22 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.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. +local gobin=$(go env GOBIN) + +if [ -z "$gobin" ]; then + gobin="$(go env GOPATH)/bin" +fi + + +BINGO="${gobin}/bingo-v0.2.3" + +CALENS="${gobin}/calens-v0.2.0" + +GOLINT="${gobin}/golint-v0.0.0-20200302205851-738671d3881b" + +GOVERAGE="${gobin}/goverage-v0.0.0-20180129164344-eec3514a20b5" + +REFLEX="${gobin}/reflex-v0.3.0" + +STATICCHECK="${gobin}/staticcheck-v0.0.1-2020.1.6" + diff --git a/Makefile b/Makefile index 5a3ab53..7468be8 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include .bingo/Variables.mk + SHELL := bash NAME := prometheus-scw-sd IMPORT := github.com/promhippie/$(NAME) @@ -72,24 +74,24 @@ vet: go vet $(PACKAGES) .PHONY: staticcheck -staticcheck: - go run honnef.co/go/tools/cmd/staticcheck -tags '$(TAGS)' $(PACKAGES) +staticcheck: $(STATICCHECK) + $(STATICCHECK) -tags '$(TAGS)' $(PACKAGES) .PHONY: lint -lint: - for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; +lint: $(GOLINT) + for PKG in $(PACKAGES); do $(GOLINT) -set_exit_status $$PKG || exit 1; done; .PHONY: generate generate: go generate $(GENERATE) .PHONY: changelog -changelog: - go run github.com/restic/calens >| CHANGELOG.md +changelog: $(CALENS) + $(CALENS) >| CHANGELOG.md .PHONY: test test: - go run github.com/haya14busa/goverage -v -coverprofile coverage.out $(PACKAGES) + go test -coverprofile coverage.out $(PACKAGES) .PHONY: install install: $(SOURCES) @@ -155,12 +157,8 @@ $(DIST)/$(EXECUTABLE)-$(OUTPUT)-linux-mips64le: .PHONY: release-darwin release-darwin: $(DIST) \ - $(DIST)/$(EXECUTABLE)-$(OUTPUT)-darwin-386 \ $(DIST)/$(EXECUTABLE)-$(OUTPUT)-darwin-amd64 -$(DIST)/$(EXECUTABLE)-$(OUTPUT)-darwin-386: - GOOS=darwin GOARCH=386 $(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $@ ./cmd/$(NAME) - $(DIST)/$(EXECUTABLE)-$(OUTPUT)-darwin-amd64: GOOS=darwin GOARCH=amd64 $(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $@ ./cmd/$(NAME) @@ -192,4 +190,4 @@ docs: .PHONY: watch watch: - go run github.com/cespare/reflex -c reflex.conf + $(REFLEX) -c reflex.conf diff --git a/changelog/unreleased/bingo-dev-tools.md b/changelog/unreleased/bingo-dev-tools.md new file mode 100644 index 0000000..9512d1e --- /dev/null +++ b/changelog/unreleased/bingo-dev-tools.md @@ -0,0 +1,7 @@ +Change: Use bingo for development tooling + +We switched to use [bingo](github.com/bwplotka/bingo) for fetching development +and build tools based on fixed defined versions to reduce the dependencies +listed within the regular go.mod file within this project. + +https://github.com/promhippie/prometheus-scw-sd/issues/15 diff --git a/changelog/unreleased/drop-darwin-386.md b/changelog/unreleased/drop-darwin-386.md new file mode 100644 index 0000000..8053381 --- /dev/null +++ b/changelog/unreleased/drop-darwin-386.md @@ -0,0 +1,6 @@ +Change: Drop dariwn/386 release builds + +We dropped the build of 386 builds on Darwin as this architecture is not +supported by current Go versions anymore. + +https://github.com/promhippie/prometheus-scw-sd/issues/17