From 9e0997ef65150db9392595ab9f2a1df593d48d22 Mon Sep 17 00:00:00 2001 From: Billy Keyes Date: Sun, 11 Aug 2024 14:39:23 -0400 Subject: [PATCH] Update Go and golangci-lint versions (#49) 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. --- .github/workflows/go.yml | 12 ++++++------ .golangci.yml | 28 ++++++++++++++++++++++++---- go.mod | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 558965e..a59475a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 ./... diff --git a/.golangci.yml b/.golangci.yml index 82dbad2..30b37f8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 diff --git a/go.mod b/go.mod index f35826e..27c3738 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/bluekeyes/go-gitdiff -go 1.13 +go 1.21