Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Antonboom/nilnil into feat/detect…
Browse files Browse the repository at this point in the history
…-opposite
  • Loading branch information
Antonboom committed Oct 6, 2024
2 parents 377554a + 22435d2 commit f63363c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ linters:
- bidichk
- asciicheck
- bodyclose
- copyloopvar
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- exhaustive
- exportloopref
- forbidigo
- gci
- gocheckcompilerdirectives
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
4 changes: 2 additions & 2 deletions pkg/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,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
}

Expand Down Expand Up @@ -157,7 +157,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)
}
Expand Down

0 comments on commit f63363c

Please sign in to comment.