butuzov / mirror

Use right mirror functions for string/[]byte performance bust
MIT License
43 stars 2 forks source link

mirror v1.1.0 panics when running on golangci-lint repo #58

Closed alexandear closed 8 months ago

alexandear commented 8 months ago

Steps to reproduce

Run the following commands:

  1. go install github.com/butuzov/mirror/cmd/mirror@latest
  2. git clone https://github.com/golangci/golangci-lint.git && cd golangci-lint
  3. mirror ./...

Expected

Nothing.

Actual

Panic when running.

Details ``` ❯ mirror ./... panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10279a1c4] goroutine 9 [running]: go/types.(*Checker).handleBailout(0x140007d0000, 0x140007cfb98) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:367 +0x9c panic({0x10295bb60?, 0x102b63d70?}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/runtime/panic.go:770 +0x124 go/types.(*StdSizes).Sizeof(0x0, {0x1029b1ee8, 0x102b67a60}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/sizes.go:228 +0x314 go/types.(*Config).sizeof(...) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/sizes.go:333 go/types.representableConst.func1({0x1029b1ee8?, 0x102b67a60?}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:76 +0x9c go/types.representableConst({0x1029b31b8, 0x102b5c728}, 0x140007d0000, 0x102b67a60, 0x140007cdd88) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:92 +0x138 go/types.(*Checker).representation(0x140007d0000, 0x1400051cc00, 0x102b67a60) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:256 +0x68 go/types.(*Checker).implicitTypeAndValue(0x140007d0000, 0x1400051cc00, {0x1029b1ee8, 0x102b67a60}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:375 +0x304 go/types.(*Checker).assignment(0x140007d0000, 0x1400051cc00, {0x1029b1ee8, 0x102b67a60}, {0x1028af8e1, 0xe}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/assignments.go:52 +0x23c go/types.(*Checker).exprInternal(0x140007d0000, 0x0, 0x1400051cc00, {0x1029b2690, 0x1400051c300}, {0x0, 0x0}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:1175 +0x1dc8 go/types.(*Checker).rawExpr(0x140007d0000, 0x0, 0x1400051cc00, {0x1029b2690?, 0x1400051c300?}, {0x0?, 0x0?}, 0x0) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:979 +0x12c go/types.(*Checker).expr(0x140007d0000, 0x1029b5a18?, 0x1400051cc00, {0x1029b2690?, 0x1400051c300?}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:1513 +0x38 go/types.(*Checker).unary(0x140007d0000, 0x1400051cc00, 0x140002846c0) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:127 +0x44 go/types.(*Checker).exprInternal(0x140007d0000, 0x0, 0x1400051cc00, {0x1029b2810, 0x140002846c0}, {0x0, 0x0}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:1406 +0x1328 go/types.(*Checker).rawExpr(0x140007d0000, 0x0, 0x1400051cc00, {0x1029b2810?, 0x140002846c0?}, {0x0?, 0x0?}, 0x0) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:979 +0x12c go/types.(*Checker).expr(0x140007d0000, 0x0?, 0x1400051cc00, {0x1029b2810?, 0x140002846c0?}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:1513 +0x38 go/types.(*Checker).varDecl(0x140007d0000, 0x14000283020, {0x140001144f0, 0x1, 0x1}, {0x0, 0x0}, {0x1029b2810, 0x140002846c0}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/decl.go:521 +0x140 go/types.(*Checker).objDecl(0x140007d0000, {0x1029b58d8, 0x14000283020}, 0x0) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/decl.go:194 +0x7ec go/types.(*Checker).packageObjects(0x140007d0000) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/resolver.go:693 +0x468 go/types.(*Checker).checkFiles(0x140007d0000, {0x14000114408, 0x1, 0x1}) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:408 +0x164 go/types.(*Checker).Files(...) /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:372 golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000182000, 0x1400098d6e0) /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:1052 +0x870 golang.org/x/tools/go/packages.(*loader).loadRecursive.func1() /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:851 +0x178 sync.(*Once).doSlow(0x0?, 0x0?) /opt/homebrew/Cellar/go/1.22.1/libexec/src/sync/once.go:74 +0x100 sync.(*Once).Do(...) /opt/homebrew/Cellar/go/1.22.1/libexec/src/sync/once.go:65 golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?) /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:839 +0x50 golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?) /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:774 +0x30 created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1 /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:773 +0xaa4 ```

Additional Info

❯ mirror -V=full
/Users/Oleksandr_Redko/go/bin/mirror version devel comments-go-here buildID=58e9a5d0ca031b6b4163ca8bc9111206f3455861d581170d169d4bbac23d73db

When I install the latest mirror from the main it doesn't panic:

❯ go install github.com/butuzov/mirror/cmd/mirror@main
go: downloading github.com/butuzov/mirror v1.1.1-0.20240207102547-601ed64d60aa
❯ mirror ./...
❯ mirror -V=full
❯ mirror -V=full
/Users/Oleksandr_Redko/go/bin/mirror version devel comments-go-here buildID=711da2304b006d3b7c49ae0a085296d21dfb4fa1940ecf6e8513ea326b1a09e6
butuzov commented 8 months ago

І ще раз дякую!

closed via https://github.com/butuzov/mirror/releases/tag/v1.2.0