From c95103534809e50083f61cbaec3f1a99e7adf5ed Mon Sep 17 00:00:00 2001 From: Anton Telyshev Date: Sun, 6 Oct 2024 10:43:53 +0300 Subject: [PATCH] Go 1.23 --- .github/workflows/ci.yml | 4 ++-- .golangci.yml | 2 +- go.mod | 8 +++++--- go.sum | 9 +++++---- pkg/analyzer/analyzer.go | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a62442..f1de3f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,8 @@ on: branches: [ master ] env: - GO_VERSION: ^1.22 - GOLANGCI_LINT_VERSION: v1.57.2 + GO_VERSION: ^1.23 + GOLANGCI_LINT_VERSION: v1.61.0 permissions: contents: read diff --git a/.golangci.yml b/.golangci.yml index 0fb1883..0d885b5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,7 @@ linters: - bidichk - asciicheck - bodyclose + - copyloopvar - dogsled - dupl - durationcheck @@ -25,7 +26,6 @@ linters: - errchkjson - errname - exhaustive - - exportloopref - forbidigo - gci - gocheckcompilerdirectives diff --git a/go.mod b/go.mod index 33ea689..9f491b4 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ module github.com/Antonboom/nilnil -go 1.20 +go 1.22.0 -require golang.org/x/tools v0.24.0 +toolchain go1.23.2 + +require golang.org/x/tools v0.26.0 require ( - golang.org/x/mod v0.20.0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index cce3a37..486c8d4 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= diff --git a/pkg/analyzer/analyzer.go b/pkg/analyzer/analyzer.go index 250cd75..f0bee07 100644 --- a/pkg/analyzer/analyzer.go +++ b/pkg/analyzer/analyzer.go @@ -87,7 +87,7 @@ func (n *nilNil) run(pass *analysis.Pass) (interface{}, error) { } ok, zv := n.isDangerNilType(fRes1Type) - if !(ok && isErrorType(fRes2Type)) { + if !(ok && implementsError(fRes2Type)) { return false } @@ -152,7 +152,7 @@ func (n *nilNil) isDangerNilType(t types.Type) (bool, zeroValue) { var errorIface = types.Universe.Lookup("error").Type().Underlying().(*types.Interface) -func isErrorType(t types.Type) bool { +func implementsError(t types.Type) bool { _, ok := t.Underlying().(*types.Interface) return ok && types.Implements(t, errorIface) }