Skip to content

Commit

Permalink
Update Go and golangci-lint versions (#49)
Browse files Browse the repository at this point in the history
The minimum Go version for the package is now Go 1.21. This is because a
future change will use the 'slices' package in test code. Note that non-test
code in the package should still be compatible with older versions of Go.

As part of this, also update the golangci-lint version to one that works
with Go 1.21, which required replacing some deprecated linters.
  • Loading branch information
bluekeyes authored Aug 11, 2024
1 parent 0a4e55f commit 9e0997e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ jobs:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.21

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.49
version: v1.59

- name: Test
run: go test -v ./...
28 changes: 24 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,41 @@ run:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gofmt
- goimports
- golint
- govet
- ineffassign
- misspell
- revive
- typecheck
- unconvert
- varcheck
- unused

issues:
exclude-use-default: false

linter-settings:
linters-settings:
goimports:
local-prefixes: github.com/bluekeyes/go-gitdiff
revive:
rules:
# enable all rules from golint
- name: context-keys-type
- name: time-naming
- name: var-declaration
- name: unexported-return
- name: errorf
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: increment-decrement
- name: var-naming
- name: package-comments
- name: range
- name: receiver-naming
- name: indent-error-flow
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/bluekeyes/go-gitdiff

go 1.13
go 1.21

0 comments on commit 9e0997e

Please sign in to comment.