cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.03k stars 3.79k forks source link

rules_go: nil pointer when calling `honnef.co/go/tools` during `UnusedLint` check #100818

Open rafiss opened 1 year ago

rafiss commented 1 year ago

This failed at https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_TestsFips_LocalRoachtestFips/9471819?showRootCauses=false&expandBuildChangesSection=true&expandBuildProblemsSection=true

  compilepkg: panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6024bc]
  goroutine 494 [running]:
  go/types.methodSet.add(0xc21360?, {0x0, 0x2, 0x0?}, {0x0, 0x0, 0x0?}, 0x1?, 0x0?)
    GOROOT/src/go/types/methodset.go:214 +0xdc
  go/types.NewMethodSet({0xc21360?, 0xc001e8eaf0?})
    GOROOT/src/go/types/methodset.go:150 +0x869
  golang.org/x/tools/go/types/typeutil.(*MethodSetCache).lookupNamed(0xc00325c030, 0xc001e8eaf0)
    golang.org/x/tools/go/types/typeutil/external/org_golang_x_tools/go/types/typeutil/methodsetcache.go:66 +0x99
  golang.org/x/tools/go/types/typeutil.(*MethodSetCache).MethodSet(0xc00325c030, {0xc21360?, 0xc001e8eaf0?})
    golang.org/x/tools/go/types/typeutil/external/org_golang_x_tools/go/types/typeutil/methodsetcache.go:37 +0xe5
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21360?, 0xc001e8eaf0?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:173 +0xf0
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21450?, 0xc001e95320?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:242 +0x775
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc213b0?, 0xc0012f5e40?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:190 +0x1b4
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21450?, 0xc001e95f38?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:242 +0x775
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc213b0?, 0xc001304570?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:190 +0x1b4
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21450?, 0xc001ec0528?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:242 +0x775
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21360?, 0xc0004555e0?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:190 +0x1b4
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21450?, 0xc001ec0588?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:242 +0x775
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21360?, 0xc000325500?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:191 +0x1d3
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21428?, 0xc001f3ff80?}, 0x1)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:237 +0x65d
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21360?, 0xc0001f1f80?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:230 +0x5ac
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc213b0?, 0xc00164a620?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:202 +0x4a7
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc21450?, 0xc002f303d8?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:242 +0x775
  honnef.co/go/tools/go/ir.(*Program).needMethods(0xc00325c000, {0xc213d8?, 0xc002f2f280?}, 0x0)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:218 +0x2e5
  honnef.co/go/tools/go/ir.(*Program).needMethodsOf(0xc00325c000, {0xc213d8?, 0xc002f2f280?})
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/methods.go:154 +0x70
  honnef.co/go/tools/go/ir.(*Package).build(0xc005d83680)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/builder.go:2524 +0x111
  sync.(*Once).doSlow(0xc00325c000?, 0xc00132e690?)
    GOROOT/src/sync/once.go:74 +0xc2
  sync.(*Once).Do(...)
    GOROOT/src/sync/once.go:65
  honnef.co/go/tools/go/ir.(*Package).Build(...)
    honnef.co/go/tools/go/ir/external/co_honnef_go_tools/go/ir/builder.go:2512
  honnef.co/go/tools/internal/passes/buildir.run(0xc0013a0340)
    honnef.co/go/tools/internal/passes/buildir/external/co_honnef_go_tools/internal/passes/buildir/buildir.go:86 +0x368
  main.(*action).execOnce(0xc0000f2fc0)
    main/external/io_bazel_rules_go/go/tools/builders/nogo_main.go:402 +0x842
  sync.(*Once).doSlow(0x0?, 0x0?)
    GOROOT/src/sync/once.go:74 +0xc2
  sync.(*Once).Do(...)
    GOROOT/src/sync/once.go:65
  main.(*action).exec(0x0?)
    main/external/io_bazel_rules_go/go/tools/builders/nogo_main.go:346 +0x3d
  main.execAll.func1(0x0?)
    main/external/io_bazel_rules_go/go/tools/builders/nogo_main.go:340 +0x54
  created by main.execAll
    main/external/io_bazel_rules_go/go/tools/builders/nogo_main.go:338 +0x47

Jira issue: CRDB-26640

Epic CRDB-36213

rafiss commented 1 year ago

and again https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_TestsFips_LocalRoachtestFips/9471819?showRootCauses=false&expandBuildChangesSection=true&expandBuildProblemsSection=true

(both times were FIPS builds, in case that's relevant)

msbutler commented 1 year ago

hit this on 23.1.0 https://teamcity.cockroachdb.com/viewLog.html?buildId=9548292&buildTypeId=Cockroach_BazelEssentialCi

rafiss commented 1 year ago

Looks like that one is not on the FIPS build, which is a good datapoint to have.

rafiss commented 1 year ago

happened here https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_BazelEssentialCi/9879065?showRootCauses=false&expandBuildChangesSection=true&expandBuildProblemsSection=true