We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
$ go version go version go1.17.2 darwin/amd64
yes
go env
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users/simbapeng/Library/Caches/go-build" GOENV="/Users/simbapeng/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/simbapeng/go/pkg/mod" GONOPROXY="git.trustasia.cn/*" GONOSUMDB="git.trustasia.cn/*" GOOS="darwin" GOPATH="/Users/simbapeng/go" GOPRIVATE="git.trustasia.cn/*" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/Cellar/go/1.17.2/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.17.2/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17.2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/simbapeng/Project/gendemo/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t0/tw9t0q2j7_z5lvxgdx_4chtm0000gn/T/go-build3502256362=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.17.2 darwin/amd64 GOROOT/bin/go tool compile -V: compile version go1.17.2 uname -v: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:25 PDT 2022; root:xnu-8020.140.41~1/RELEASE_X86_64 ProductName: macOS ProductVersion: 12.5 BuildVersion: 21G72 lldb --version: lldb-1316.0.9.46 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
//go:build wireinject // +build wireinject package main import ( "io" "os" "github.com/google/wire" ) type foo struct{} type bar struct{} func (foo) injectWriter() io.Writer { wire.Build(wire.InterfaceValue(new(io.Writer), os.Stdout)) return nil } func (bar) injectWriter() io.Writer { wire.Build(wire.InterfaceValue(new(io.Writer), os.Stderr)) return nil }
package main import ( "io" "os" ) // Injectors from main.go: func (foo) injectWriter() io.Writer { writer := _wireFileValue return writer } var ( _wireFileValue = os.Stdout ) func (bar) injectWriter() io.Writer { writer := _wireOsFileValue return writer } var ( _wireOsFileValue = os.Stderr ) // main.go: type foo struct{} type bar struct{}
Wire generates broken code. It generates function without receiver.
package main import ( "io" "os" ) // Injectors from main.go: func injectWriter() io.Writer { writer := _wireFileValue return writer } var ( _wireFileValue = os.Stdout ) func injectWriter() io.Writer { writer := _wireOsFileValue return writer } var ( _wireOsFileValue = os.Stderr ) // main.go: type foo struct{} type bar struct{}
The text was updated successfully, but these errors were encountered:
fix: generate injection method with receiver (google#371)
574d7a8
Successfully merging a pull request may close this issue.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
What did you see instead?
Wire generates broken code. It generates function without receiver.
The text was updated successfully, but these errors were encountered: