Skip to content

Commit

Permalink
Swap Makefile for Taskfile (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheProcess authored Apr 17, 2024
1 parent 56cfc3f commit 67d52ab
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 43 deletions.
83 changes: 78 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,104 @@ linters:
- nilerr
- nilnil
- nolintlint
- nakedret
- predeclared
- reassign
- revive
- staticcheck
- tagliatelle
- tenv
- testpackage
- unconvert
- unparam
- unused
- whitespace

linters-settings:
errcheck:
check-type-assertions: true
check-blank: true

exhaustive:
check:
- switch
- map
default-signifies-exhaustive: true

gocyclo:
min-complexity: 20

staticcheck:
go: "1.20"
checks: ["all"]

errcheck:
check-type-assertions: true
check-blank: true

gosimple:
checks: ["all"]

govet:
enable-all: true

revive:
max-open-files: 256
ignore-generated-header: true
rules:
- name: argument-limit
disabled: false
arguments: [5]

- name: atomic
disabled: false

- name: blank-imports
disabled: false

- name: call-to-gc
disabled: false

- name: constant-logical-expr
disabled: false

- name: context-as-argument
disabled: false

- name: datarace
disabled: false

- name: deep-exit
disabled: false

- name: defer
disabled: false

- name: dot-imports
disabled: false

- name: early-return
disabled: false

- name: exported
arguments:
- checkPrivateReceivers

- name: modifies-value-receiver
disabled: false

- name: package-comments
disabled: false

- name: range
disabled: false

- name: range-val-in-closure
disabled: false

- name: range-val-address
disabled: false

- name: time-equal
disabled: false

- name: use-any
disabled: false

- name: waitgroup-by-value
disabled: false
38 changes: 0 additions & 38 deletions Makefile

This file was deleted.

66 changes: 66 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# https://taskfile.dev

version: "3"

vars:
COV_DATA: coverage.out

tasks:
default:
desc: List all available tasks
silent: true
cmd: task --list

tidy:
desc: Tidy dependencies in go.mod and go.sum
cmd: go mod tidy

fmt:
desc: Run go fmt on all source files
cmd: go fmt ./...

test:
desc: Run the test suite
cmd: go test -race ./... {{ .CLI_ARGS }}

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

lint:
desc: Run the linters and auto-fix if possible
cmd: 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
preconditions:
- sh: command -v pkgsite
msg: pkgsite not installed, run go install golang.org/x/pkgsite/cmd/pkgsite@latest

cov:
desc: Calculate test coverage and render the html
generates:
- "{{ .COV_DATA }}"
cmds:
- go test -race -cover -covermode atomic -coverprofile {{ .COV_DATA }} ./...
- go tool cover -html {{ .COV_DATA }}

check:
desc: Run tests and linting in one
cmds:
- task: test
- task: lint

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

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

0 comments on commit 67d52ab

Please sign in to comment.