Skip to content

Commit 45224c5

Browse files
author
Utku Ozdemir
committed
refactor: improve taskfile & linters
1 parent 9159b95 commit 45224c5

2 files changed

Lines changed: 34 additions & 89 deletions

File tree

.golangci.yml

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ linters:
33
enable-all: true
44
disable:
55
# deprecated:
6+
- deadcode
67
- exhaustivestruct
78
- golint
9+
- ifshort
810
- interfacer
911
- maligned
12+
- nosnakecase
1013
- scopelint
11-
- ifshort
14+
- structcheck
15+
- varcheck
1216
# not useful
1317
- exhaustruct
1418
# todo: consider enabling:
@@ -19,87 +23,11 @@ linters:
1923

2024
linters-settings:
2125
gci:
22-
local-prefixes: github.com/utkuozdemir/pv-migrate
26+
sections:
27+
- standard
28+
- default
29+
- prefix(github.com/utkuozdemir/pv-migrate)
2330
goimports:
2431
local-prefixes: github.com/utkuozdemir/pv-migrate
2532
goconst:
2633
ignore-tests: true
27-
28-
29-
#
30-
#
31-
## https://golangci-lint.run/usage/linters/
32-
#linters:
33-
# enable:
34-
# - asciicheck
35-
# - bidichk
36-
# - containedctx
37-
# - contextcheck
38-
# - cyclop
39-
# - decorder
40-
# - dogsled
41-
# - dupl
42-
# - durationcheck
43-
# - errname
44-
# - errorlint
45-
# - exhaustive
46-
# - exportloopref
47-
# - forbidigo
48-
# - forcetypeassert
49-
# - funlen
50-
# - gci
51-
## - gochecknoglobals
52-
# - gochecknoinits
53-
# - gocognit
54-
# - goconst
55-
# - gocritic
56-
# - gocyclo
57-
# - godot
58-
# - godox
59-
# - goerr113
60-
# - gofumpt
61-
# - goheader
62-
## - goimports # inconsistent with gci
63-
# - gomnd
64-
# - gomoddirectives
65-
## - gomodguard # no need
66-
# - goprintffuncname
67-
# - gosec
68-
# - grouper
69-
# - ifshort
70-
# - importas
71-
## - ireturn # TODO revisit
72-
# - lll
73-
# - maintidx
74-
# - makezero
75-
# - misspell
76-
# - nakedret
77-
# - nestif
78-
# - nilerr
79-
# - nilnil
80-
# - nlreturn
81-
# - noctx
82-
# - nolintlint
83-
# - paralleltest
84-
# - prealloc
85-
# - predeclared
86-
# - revive
87-
# - rowserrcheck
88-
## - sqlclosecheck
89-
# - stylecheck
90-
# - tagliatelle
91-
# - tenv
92-
## - testpackage # TODO: visit
93-
# - thelper
94-
# - tparallel
95-
# - unconvert
96-
# - unparam
97-
# - varnamelen
98-
# - wastedassign
99-
# - whitespace
100-
## - wrapcheck # TODO: visit
101-
# - wsl
102-
#
103-
#linters-settings:
104-
# goconst:
105-
# ignore-tests: true

Taskfile.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ version: "3"
33
tasks:
44
fmt:
55
desc: format code
6+
vars:
7+
MODULE:
8+
sh: head -n 1 go.mod | cut -d' ' -f2
69
cmds:
710
- go mod tidy
8-
- gci write -s standard -s default -s "prefix(github.com/utkuozdemir/pv-migrate)" .
11+
- gci write -s standard -s default -s "prefix({{.MODULE}})" .
912
- gofumpt -w -l .
1013

1114
lint:
@@ -15,18 +18,32 @@ tasks:
1518
- helm lint helm/pv-migrate
1619

1720
update-chart:
18-
desc: Update the Helm chart
21+
desc: update the helm chart
1922
cmds:
2023
- helm-docs -c helm/pv-migrate/
2124
- helm package helm/pv-migrate/
2225
- mv pv-migrate-*.tgz internal/migrator/helm-chart.tgz
2326

27+
clean:
28+
desc: clean
29+
cmds:
30+
- rm -rf {{.ROOT_DIR}}/dist/
31+
32+
build:
33+
desc: build
34+
cmds:
35+
- goreleaser build --snapshot --rm-dist --single-target
36+
2437
release:
25-
desc: Create a new tag
38+
desc: release
2639
vars:
27-
NEXT:
28-
sh: svu n
40+
NUM_LAST_TAGS: 3
41+
LAST_TAGS:
42+
sh: git tag --sort=-version:refname | head -n {{.NUM_LAST_TAGS}} | xargs echo
43+
NEXT_TAG:
44+
sh: svu next
2945
cmds:
30-
- git tag {{.NEXT}}
31-
- echo {{.NEXT}}
32-
- git push origin {{.NEXT}}
46+
- "echo Last {{.NUM_LAST_TAGS}} tags: {{.LAST_TAGS}}"
47+
- "echo Next tag: {{.NEXT_TAG}}"
48+
- git tag -a {{.NEXT_TAG}} -m "Release {{.NEXT_TAG}}"
49+
- git push origin {{.NEXT_TAG}}

0 commit comments

Comments
 (0)