Skip to content
New issue

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

x/blog: in /wire blog post, go generate example not working (?) #39872

Open
jeffdahl opened this issue Jun 26, 2020 · 4 comments
Open

x/blog: in /wire blog post, go generate example not working (?) #39872

jeffdahl opened this issue Jun 26, 2020 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jeffdahl
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.14.3 linux/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/nas/jeff/.cache/go-build"
GOENV="/nas/jeff/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/nas/jeff/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build483193468=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go generate did nothing, while wire worked.

What did you expect to see?

A wire generated file.

What did you see instead?

No wire generated file.

@gopherbot gopherbot added this to the Unreleased milestone Jun 26, 2020
@ALTree
Copy link
Member

ALTree commented Jun 26, 2020

Hi,

What did you do?

go generate did nothing, while wire worked.

I'm not sure what this means. Can you add more details (are you reading a blog post on blog.golang.org? Which one?)?

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 26, 2020
@ALTree ALTree changed the title x/blog: x/blog: go generate not working (?) Jun 26, 2020
@ALTree ALTree changed the title x/blog: go generate not working (?) x/blog: go generate example not working (?) Jun 26, 2020
@D1CED
Copy link

D1CED commented Jun 26, 2020

This one most likely: https://blog.golang.org/wire

But the example fails intentionally. So did OP copy the fix?

@jeffdahl
Copy link
Author

Yes, I was following the example at https://blog.golang.org/wire where it states:
`Now we run go generate to execute wire:

$ go generate
wire.go:2:10: inject initUserStore: no provider found for ConnectionInfo (required by provider of *mysql.DB)
wire: generate failed`

At this point, I did not realize one is required to run wire before go generate.

@ALTree ALTree removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 2, 2020
@dmitshur
Copy link
Contributor

dmitshur commented Jul 3, 2020

It seems that error is expected. The next paragraph says:

Oops! We didn't include a ConnectionInfo or tell Wire how to build one. Wire helpfully tells us the line number and types involved. We can either add a provider for it to wire.Build, or add it as an argument:

[...]

Now go generate will create a new file with the generated code:

Did you follow those steps?

Also, what's the output if you run go generate -x?

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 3, 2020
@dmitshur dmitshur changed the title x/blog: go generate example not working (?) x/blog: in /wire blog post, go generate example not working (?) Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants