google / wire

Compile-time Dependency Injection for Go

Repository from Github https://github.comgoogle/wireRepository from Github https://github.comgoogle/wire

TestWire/UnexportedStruct fails because of the error wording

dmitris opened this issue · comments

Describe the bug

go test ./... fails with go1.23.0 and go1.22.6 due to a minor change in the error wording:

$ go test ./...
?   	github.com/google/wire	[no test files]
?   	github.com/google/wire/cmd/wire	[no test files]
--- FAIL: TestWire (0.02s)
    --- FAIL: TestWire/UnexportedStruct (1.66s)
        wire_test.go:108: /private/var/folders/k5/p407cqn15lv4np6p1jt_49q00000gq/T/wire_test1432212345/src/example.com/foo/wire.go:26:17: name foo not exported by package bar
        wire_test.go:121: Errors didn't match expected errors from wire_errors.txt:
            {[]string}[0]:
            	-: "example.com/foo/wire.go:x:y: name foo not exported by package bar"
            	+: "example.com/foo/wire.go:x:y: foo not exported by package bar"
FAIL
FAIL	github.com/google/wire/internal/wire	10.686s
FAIL

To Reproduce

Run go test ./... with go1.22.6 or go1.23.0 (didn't try other versions yet)

Expected behavior

tests pass without error

A clear and concise description of what you expected to happen.
TestWire/UnexportedStruct fails:

$ go test ./...
?   	github.com/google/wire	[no test files]
?   	github.com/google/wire/cmd/wire	[no test files]
--- FAIL: TestWire (0.02s)
    --- FAIL: TestWire/UnexportedStruct (1.66s)
        wire_test.go:108: /private/var/folders/k5/p407cqn15lv4np6p1jt_49q00000gq/T/wire_test1432212345/src/example.com/foo/wire.go:26:17: name foo not exported by package bar
        wire_test.go:121: Errors didn't match expected errors from wire_errors.txt:
            {[]string}[0]:
            	-: "example.com/foo/wire.go:x:y: name foo not exported by package bar"
            	+: "example.com/foo/wire.go:x:y: foo not exported by package bar"
FAIL
FAIL	github.com/google/wire/internal/wire	10.686s
FAIL

Version

Which version of Wire are you seeing the bug with?
the latest trunk (main branch) - commit e57deea)

Additional context

A simple change of the error text in https://github.com/google/wire/blob/main/internal/wire/testdata/UnexportedStruct/want/wire_errs.txt#L1 fixes the test error, I will raise a PR to fix this.