Skip to content

Commit

Permalink
chore: update CI and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 28, 2024
1 parent 49360e9 commit 7b171cf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 64 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ jobs:

strategy:
matrix:
go-version: [ stable ]
go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout code
uses: actions/checkout@v4

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ jobs:
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.55.2
GOLANGCI_LINT_VERSION: v1.59.1
CGO_ENABLED: 0

steps:

# https://github.com/marketplace/actions/checkout
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand Down
76 changes: 36 additions & 40 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
run:
timeout: 2m

linters:
enable-all: true
disable:
- gomnd # deprecated
- execinquery # deprecated
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- cyclop # duplicate of gocyclo
- lll
- dupl
- prealloc
- wsl
- nlreturn
- stylecheck
- testpackage
- paralleltest
- tparallel
- wrapcheck
- exhaustive
- exhaustruct
- makezero
- godot
- varnamelen
- nilnil

linters-settings:
govet:
enable-all: true
Expand All @@ -11,10 +36,9 @@ linters-settings:
goconst:
min-len: 5
min-occurrences: 3
gomnd:
settings:
mnd:
ignored-functions: os.*
mnd:
ignored-functions:
- os.*
misspell:
locale: US
ignore-words:
Expand Down Expand Up @@ -61,42 +85,11 @@ linters-settings:
gosec:
excludes:
- G204

linters:
enable-all: true
disable:
- scopelint # deprecated
- interfacer # deprecated
- maligned # deprecated
- golint # deprecated
- exhaustivestruct # deprecated
- scopelint # deprecated
- varcheck # deprecated
- structcheck # deprecated
- nosnakecase # deprecated
- deadcode # deprecated
- ifshort # deprecated
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- cyclop # duplicate of gocyclo
- lll
- dupl
- prealloc
- scopelint
- wsl
- nlreturn
- stylecheck
- testpackage
- paralleltest
- tparallel
- wrapcheck
- exhaustive
- exhaustruct
- makezero
- ifshort
- godot
- varnamelen
- nilnil
perfsprint:
err-error: true
errorf: true
sprintf1: true
strconcat: false

issues:
exclude-use-default: false
Expand All @@ -122,3 +115,6 @@ issues:
text: 'G306:'
- path: internal/generator.go
text: 'mnd: Magic number: 0644, in <argument> detected'

output:
show-stats: true
10 changes: 5 additions & 5 deletions worktree/worktree.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func Add(path, branch string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("add")
g.AddOptions(path)
if len(branch) > 0 {
if branch != "" {
g.AddOptions(branch)
}
}
Expand Down Expand Up @@ -50,7 +50,7 @@ func Force(g *types.Cmd) {
func Branch(branch string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("-b")
if len(branch) > 0 {
if branch != "" {
g.AddOptions(branch)
}
}
Expand All @@ -60,7 +60,7 @@ func Branch(branch string) func(*types.Cmd) {
func BranchOverride(branch string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("-B")
if len(branch) > 0 {
if branch != "" {
g.AddOptions(branch)
}
}
Expand Down Expand Up @@ -105,7 +105,7 @@ func Verbose(g *types.Cmd) {
func Expire(time string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("--expire")
if len(time) > 0 {
if time != "" {
g.AddOptions(time)
}
}
Expand All @@ -115,7 +115,7 @@ func Expire(time string) func(*types.Cmd) {
func Reason(value string) func(*types.Cmd) {
return func(g *types.Cmd) {
g.AddOptions("--reason")
if len(value) > 0 {
if value != "" {
g.AddOptions(value)
}
}
Expand Down

0 comments on commit 7b171cf

Please sign in to comment.