Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update project from template #75

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,58 @@ tasks:
default:
desc: List all available tasks
silent: true
cmd: task --list
cmds:
- task --list

tidy:
desc: Tidy dependencies in go.mod and go.sum
cmd: go mod tidy
sources:
- "**/*.go"
- go.mod
- go.sum
cmds:
- go mod tidy

fmt:
desc: Run go fmt on all source files
cmd: go fmt ./...
sources:
- "**/*.go"
preconditions:
- sh: command -v golines
msg: golines not installed, see https://github.com/segmentio/golines
cmds:
- go fmt ./...
- golines . --ignore-generated --write-output

test:
desc: Run the test suite
cmd: go test -race ./... {{ .CLI_ARGS }}
sources:
- "**/*.go"
cmds:
- go test -race ./... {{ .CLI_ARGS }}

bench:
desc: Run all project benchmarks
cmd: go test ./... -run None -benchmem -bench . {{ .CLI_ARGS }}
sources:
- "**/*.go"
cmds:
- go test ./... -run None -benchmem -bench . {{ .CLI_ARGS }}

lint:
desc: Run the linters and auto-fix if possible
cmd: golangci-lint run --fix
sources:
- "**/*.go"
- .golangci.yml
cmds:
- golangci-lint run --fix
preconditions:
- sh: command -v golangci-lint
msg: golangci-lint not installed, see https://golangci-lint.run/usage/install/#local-installation

doc:
desc: Render the pkg docs locally
cmd: pkgsite -open
cmds:
- pkgsite -open
preconditions:
- sh: command -v pkgsite
msg: pkgsite not installed, run go install golang.org/x/pkgsite/cmd/pkgsite@latest
Expand All @@ -57,10 +81,17 @@ tasks:

sloc:
desc: Print lines of code
cmd: fd . -e go | xargs wc -l | sort -nr | head
cmds:
- fd . -e go | xargs wc -l | sort -nr | head

clean:
desc: Remove build artifacts and other clutter
cmds:
- go clean ./...
- rm -rf {{ .COV_DATA }}

update:
desc: Updates dependencies in go.mod and go.sum
cmds:
- go get -u ./...
- go mody tidy
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ require github.com/fatih/color v1.17.0
require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Loading