-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
125 additions
and
58 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/go | ||
{ | ||
"name": "Go", | ||
"image": "mcr.microsoft.com/devcontainers/go", | ||
"features": { | ||
"ghcr.io/guiyomh/features/golangci-lint:0": {}, | ||
"ghcr.io/devcontainers-contrib/features/go-task:1": {} | ||
}, | ||
"postCreateCommand": "go mod download", | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "go version", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.go", | ||
"shardulm94.trailing-spaces", | ||
"IBM.output-colorizer", | ||
"task.vscode-task", | ||
"github.vscode-github-actions", | ||
"redhat.vscode-yaml" | ||
] | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ stunner | |
*.sh | ||
*.txt | ||
*.tar.gz | ||
*.exe | ||
release/ | ||
dist/ | ||
.env/ | ||
|
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: "3" | ||
|
||
vars: | ||
PROGRAM: stunner | ||
|
||
tasks: | ||
update: | ||
cmds: | ||
- go get -u | ||
- go mod tidy -v | ||
|
||
build: | ||
aliases: [default] | ||
cmds: | ||
- go fmt ./... | ||
- go vet ./... | ||
- go build -o {{.OUTPUT_FILE | default .PROGRAM}} | ||
env: | ||
CGO_ENABLED: 0 | ||
|
||
linux: | ||
cmds: | ||
- task: build | ||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: linux | ||
GOARCH: amd64 | ||
|
||
windows: | ||
cmds: | ||
- task: build | ||
vars: | ||
OUTPUT_FILE: "{{.PROGRAM}}.exe" | ||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: windows | ||
GOARCH: amd64 | ||
|
||
test: | ||
env: | ||
CGO_ENABLED: 1 # required by -race | ||
cmds: | ||
- go test -race -cover ./... | ||
|
||
lint: | ||
cmds: | ||
- golangci-lint run ./... --timeout=30m | ||
- go mod tidy | ||
|
||
lint-update: | ||
cmds: | ||
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b {{ .GOPATH }}/bin | ||
- golangci-lint --version | ||
vars: | ||
GOPATH: | ||
sh: go env GOPATH | ||
|
||
tag: | ||
cmds: | ||
- git tag -a "${TAG}" -m "${TAG}" | ||
- git push origin "${TAG}" | ||
preconditions: | ||
- sh: '[[ -n "${TAG}" ]]' | ||
msg: "Please set the TAG environment variable" |
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