This repository was archived by the owner on Aug 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 722
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
panic in related to Bind with a pointer #201
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingneeds infoFurther discussion or clarification is necessaryFurther discussion or clarification is necessary
Description
Describe the bug
Panic when running wire ./...
To Reproduce
Sorry, I can't give a specific repro because
- I worked around it as soon as I ran into it
- There's a lot of proprietary code involved and it would have been pretty hard to isolate
The error was related to a bind statement:
wire.Bind(new(Interface), new(*Concrete)),
I don't know what was unusual about this bind statement. There was New function that returns a pointer to Concrete and *Concrete implements Interface. In 0.2.2, I was able to use new(Concrete), but I had to change that to new(*Concrete) after upgrading to 0.3.0 and that's when the panic happened.
I hope that the following stack trace helps. If not, we might want to wait for someone to run into this again and provide a repro.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x64488d]
goroutine 1 [running]:
go/types.(*Package).Path(...)
/home/<user>/.go/src/go/types/package.go:30
github.com/google/wire/internal/wire.(*objectCache).get(0xc03b480880, 0x76bb60, 0xc00008cc30, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:464 +0x7d
github.com/google/wire/internal/wire.(*objectCache).processExpr(0xc03b480880, 0xc03a9324b0, 0xc000cfdce0, 0x5b, 0x766e60, 0xc03a9394c0, 0x0, 0x0, 0x0, 0x0, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:523 +0xfd3
github.com/google/wire/internal/wire.(*objectCache).processNewSet(0xc03b480880, 0xc03a9324b0, 0xc000cfdce0, 0x5b, 0xc03a9c1980, 0x0, 0xc03a905620, 0xf, 0xc000656ec0, 0x58632c, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:592 +0x18a
github.com/google/wire/internal/wire.(*objectCache).processExpr(0xc03b480880, 0xc03a9324b0, 0xc000cfdce0, 0x5b, 0x766a60, 0xc03a9c1980, 0xc03a905620, 0xf, 0xf, 0xc000026500, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:535 +0x519
github.com/google/wire/internal/wire.(*objectCache).get(0xc03b480880, 0x76bd40, 0xc03a9331d0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:489 +0x42e
github.com/google/wire/internal/wire.(*objectCache).processExpr(0xc03b480880, 0xc03b4684b0, 0xc0003737a0, 0x51, 0x7671a0, 0xc03b441b60, 0x0, 0x0, 0x68c340, 0xc03b4e1320, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:523 +0xfd3
github.com/google/wire/internal/wire.(*objectCache).processNewSet(0xc03b480880, 0xc03b4684b0, 0xc0003737a0, 0x51, 0xc03b466e40, 0x0, 0xc03b4432a0, 0x16, 0xc0006573e8, 0x58632c, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:592 +0x18a
github.com/google/wire/internal/wire.(*objectCache).processExpr(0xc03b480880, 0xc03b4684b0, 0xc0003737a0, 0x51, 0x766a60, 0xc03b466e40, 0xc03b4432a0, 0x16, 0x16, 0xc000026500, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:535 +0x519
github.com/google/wire/internal/wire.(*objectCache).get(0xc03b480880, 0x76bd40, 0xc03b468550, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:489 +0x42e
github.com/google/wire/internal/wire.(*objectCache).processExpr(0xc03b480880, 0xc03b468e10, 0xc0002f6eb0, 0x49, 0x7671a0, 0xc03b4770a0, 0x0, 0x0, 0x6b2cc0, 0xc039982600, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:523 +0xfd3
github.com/google/wire/internal/wire.(*objectCache).processNewSet(0xc03b480880, 0xc03b468e10, 0xc0002f6eb0, 0x49, 0xc03b467680, 0xc03b4808e0, 0x0, 0x0, 0x0, 0x0, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/parse.go:592 +0x18a
github.com/google/wire/internal/wire.generateInjectors(0xc03b469f90, 0xc000da5770, 0x2, 0xc0393f10a0, 0x69, 0x0, 0x0, 0xc00000c0b0)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/wire.go:176 +0xaaf
github.com/google/wire/internal/wire.Generate(0x767ca0, 0xc0000120d8, 0xc000020004, 0x40, 0xc000010c00, 0x59, 0x59, 0xc00000c0b0, 0x1, 0x1, ...)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/internal/wire/wire.go:99 +0x412
main.(*genCmd).Execute(0xc000047eb0, 0x767ca0, 0xc0000120d8, 0xc00005a180, 0x0, 0x0, 0x0, 0x7f97cf1e8008)
/home/<user>/go/pkg/mod/github.com/google/[email protected]/cmd/wire/main.go:131 +0x249
main.main()
/home/<user>/go/pkg/mod/github.com/google/[email protected]/cmd/wire/main.go:71 +0x4a1
exit status 2
Expected behavior
No panic
Version
0.3.0
Additional context
Sorry, too much proprietary code. Hope there's something obvious that recently changed and the stack trace helps.
anton-dessiatov
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds infoFurther discussion or clarification is necessaryFurther discussion or clarification is necessary