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

the latest version can not build with go1.16, should update to go 1.17 #2713

Closed
chengyizhoucode opened this issue May 25, 2022 · 8 comments · Fixed by #2734
Closed

the latest version can not build with go1.16, should update to go 1.17 #2713

chengyizhoucode opened this issue May 25, 2022 · 8 comments · Fixed by #2734

Comments

@chengyizhoucode
Copy link

chengyizhoucode commented May 25, 2022

🐛 Bug Report

image

To Reproduce

(Write your steps here:)

go build will fail, the error is "go:build comment without // +build "

Your Environment

go 1.16

@chengyizhoucode chengyizhoucode changed the title the latest version can not build by go1.16,should update to go 1.17 the latest version can not build with go1.16, should update to go 1.17 May 25, 2022
@johanbrandhorst
Copy link
Collaborator

Hi, thanks for your issue! I'm confused, but I think what you're saying is that you're trying to build with Go 1.16 and you're getting an error. I don't know what the shared screenshot is supposed to illustrate. I assume the error is here:

//go:build go1.18
?

We currently only test with go 1.17 and go 1.18, but 1.16 sounds reasonable since we do expose a library. Would you be willing to contribute this fix?

@dany1233
Copy link

I have same problem.

@benhoyt
Copy link

benhoyt commented Jun 1, 2022

I believe this was broken with the release of version v2.10.2, when that fuzz file was introduced. See also https://stackoverflow.com/a/72455753/68707. All that needs to happen is to add a // +build go1.18 line below the //go:build go1.18 one, similar to this file.

johanbrandhorst added a commit that referenced this issue Jun 1, 2022
@benhoyt
Copy link

benhoyt commented Jun 1, 2022

Thanks @johanbrandhorst. It looks like there's a similar case in examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go:19 (I guess a generated file?). Probably best to add Go 1.16 to CI if you want to support this (I'd recommend it ... not everyone can or has upgraded to Go 1.17/1.18 easily).

@johanbrandhorst
Copy link
Collaborator

Thanks @johanbrandhorst. It looks like there's a similar case in examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go:19 (I guess a generated file?). Probably best to add Go 1.16 to CI if you want to support this (I'd recommend it ... not everyone can or has upgraded to Go 1.17/1.18 easily).

I'm confused, I don't see any build tags in there? This file: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go#L19?

@benhoyt
Copy link

benhoyt commented Jun 1, 2022

Oh, sorry, I was confused by the output of go test ./... with Go 1.16:

$ go1.16.15 test ./...
examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go:19:2: //go:build comment without // +build comment
examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go:19:2: //go:build comment without // +build comment

It's referring to the build constraint of the imported package, which is the runtime one you've already fixed.

@chengyizhoucode
Copy link
Author

chengyizhoucode commented Jun 1, 2022

I believe this was broken with the release of version v2.10.2, when that fuzz file was introduced. See also https://stackoverflow.com/a/72455753/68707. All that needs to happen is to add a // +build go1.18 line below the //go:build go1.18 one, similar to this file.

yeah, that is what wo want to say ,
I also agree with this solution
haha ha

@johanbrandhorst
Copy link
Collaborator

PSA: Since 1.19 is released, the new release of the grpc-gateway will require Go 1.17+. I hope this is acceptable to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants