File tree Expand file tree Collapse file tree 8 files changed +939
-9
lines changed Expand file tree Collapse file tree 8 files changed +939
-9
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,23 @@ generate: ## Run all code generators
2727
2828.PHONY : test
2929test : # # Run all unit tests.
30- go test ./...
30+ go test -v ./...
3131
3232.PHONY : verify
33- verify : # # Run all code analysis tools and linters .
33+ verify : # # Run all static analysis checks .
3434 # Check if codebase is formatted.
35- @echo " gofmt -l . "
36- @bash -c " [ -z $$ (gofmt -l .) ] && echo 'OK' || (echo 'ERROR: files are not formatted:' && gofmt -l . && false)"
35+ @which goimports > /dev/null || ! echo ' goimports not found '
36+ @bash -c " [ -z \" $( goimports -l cmd pkg ) \" ] && echo 'OK' || (echo 'ERROR: files are not formatted:' && goimports -l cmd pkg && echo -e \" \nRun 'make format' or manually fix the formatting issues.\n \" && false)"
3737 # Run static checks on codebase.
38- go vet ./...
38+ go vet ./cmd/... ./pkg/ ...
3939
4040.PHONY : format
4141format : # # Run all formatters on the codebase.
42- go fmt ./...
42+ # Format the Go codebase.
43+ goimports -w cmd pkg
44+
45+ # Format the go.mod file.
46+ go mod tidy
4347
4448.PHONY : release
4549release : clean generate verify test # # Build and release goversion, publishing the artifacts on Github and Dockerhub.
Original file line number Diff line number Diff line change 2323### Using Go tools
2424
2525
26- ### Using Go install
26+
27+ ### Using Go install (deprecated)
2728``` bash
2829GO11MODULE=off go install github.com/erwinvaneyk/goversion/cmd/goversion
2930```
Original file line number Diff line number Diff line change 55require (
66 github.com/erwinvaneyk/cobras v0.0.0-20200610150702-9e7b3fed53bf
77 github.com/ghodss/yaml v1.0.0
8+ github.com/goreleaser/goreleaser v0.143.0
89 github.com/spf13/cobra v1.0.0
9- github.com/spf13/pflag v1 .0.5 // indirect
10+ golang.org/x/tools v0 .0.0-20200928112810-42b62fc93869 // indirect
1011)
Load Diff Large diffs are not rendered by default.
File renamed without changes.
Original file line number Diff line number Diff line change 1- //go:generate goversion generate --goversion "" --pkg goversion -o version .gen.go
1+ //go:generate goversion generate --goversion "" --pkg goversion -o goversion .gen.go
22package goversion
33
44import (
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ func NewCmdLDFlags() *cobra.Command {
2626
2727 cmd := & cobra.Command {
2828 Use : "ldflags" ,
29+ Short : "Collect version information from host and print as valid Go ldflags." ,
2930 Run : cobras .Run (opts ),
3031 }
3132
Original file line number Diff line number Diff line change 1+ // +build tools
2+ // The build tag above ensures that the imports in this file will not be
3+ // included in the binaries using this package.
4+ //
5+ // To add dependencies, add the tool to the go mod
6+ // `go get -u golang.org/x/lint/golint`
7+ // Then, add it as an import to this file.
8+ //
9+ // To install the tools specified in this file, run the following:
10+ // `go generate tools.go`
11+ // or directly from tools.go:
12+ // `cat tools.go | grep '^\s_ ' | sed 's/^.*_ "\(.*\)"/\1/g' | xargs -tI % go install %`
13+
14+ //go:generate go install github.com/goreleaser/goreleaser
15+ //go:generate go install golang.org/x/tools/cmd/goimports
16+ package goversion
17+
18+ import (
19+ _ "github.com/goreleaser/goreleaser"
20+ _ "golang.org/x/tools/cmd/goimports"
21+ )
You can’t perform that action at this time.
0 commit comments