-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* go/1.19 * spf13/cobra v1.6.1
- Loading branch information
Showing
7 changed files
with
47 additions
and
815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
BIN_NAME=golang-cli-template | ||
IMAGE_NAME=thazelart/${BIN_NAME} | ||
BIN_PATH=${GOPATH}/bin | ||
GO_VERSION=1.17 | ||
GO_VERSION=1.19 | ||
|
||
help: | ||
@echo 'Management commands for golang-cli-template:' | ||
@echo | ||
@echo 'Usage:' | ||
@echo ' make get-deps Runs dep ensure, mostly used for ci.' | ||
@echo ' make build Compile the project.' | ||
@echo ' make docker-build Compile optimized for alpine linux.' | ||
@echo ' make test-goreleaser Ensure the goreleaser config is valid.' | ||
@echo | ||
default: help | ||
|
||
test-goreleaser: | ||
## Test the goreleaser configuration locally. | ||
test/goreleaser: | ||
goreleaser --snapshot --skip-publish --rm-dist | ||
|
||
get-deps: | ||
## Run the unit tests. | ||
test/go: | ||
go test ./... | ||
|
||
## Get this project dependencies. | ||
local/deps: | ||
go mod download | ||
|
||
build: | ||
## Build locally the go project. | ||
go/build: | ||
@echo "building ${BIN_NAME}" | ||
@echo "GOPATH=${GOPATH}" | ||
go generate ./... | ||
go build -o ${BIN_PATH}/${BIN_NAME} | ||
|
||
docker-build: | ||
## Compile optimized for alpine linux. | ||
docker/build: | ||
@echo "building image ${IMAGE_NAME}" | ||
docker build --build-arg GO_VERSION=${GO_VERSION} -t $(IMAGE_NAME):latest . | ||
|
||
## Print his help screen | ||
help: | ||
@printf "Available targets:\n\n" | ||
@awk '/^[a-zA-Z\-\_0-9%:\\]+/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = $$1; \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
gsub("\\\\", "", helpCommand); \ | ||
gsub(":+$$", "", helpCommand); \ | ||
printf " \x1b[32;01m%-15s\x1b[0m %s\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u | ||
@printf "\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
module github.com/thazelart/golang-cli-template | ||
|
||
go 1.17 | ||
go 1.19 | ||
|
||
require ( | ||
github.com/spf13/cobra v1.4.0 | ||
github.com/spf13/viper v1.10.1 | ||
github.com/spf13/cobra v1.6.1 | ||
github.com/stretchr/testify v1.7.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/fsnotify/fsnotify v1.5.1 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.1 // indirect | ||
github.com/kr/pretty v0.2.0 // indirect | ||
github.com/magiconair/properties v1.8.5 // indirect | ||
github.com/mitchellh/mapstructure v1.4.3 // indirect | ||
github.com/pelletier/go-toml v1.9.4 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/spf13/afero v1.6.0 // indirect | ||
github.com/spf13/cast v1.4.1 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.2.0 // indirect | ||
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect | ||
gopkg.in/ini.v1 v1.66.2 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.