2

I have been working on my branch for a couple of days. Meanwhile the master branch has evolved, so I do git rebase master.

The output shows CONFLICTs in some files:

Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: could not apply 1bd673ea... update vendor folder
Resolve all conflicts manually, mark them as resolved with
update vendor folder
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 1bd673ea... update vendor folder

After fixing the conflicts, I do go mod tidy and then go mod vendor. The result is a strange message:

internal error: failed to find embedded files of github.com/grpc-ecosystem/grpc-gateway/v2/runtime: //go:build comment without // +build comment

What does this mean and how can I avoid it?

Csongor Halmai
  • 3,239
  • 29
  • 30

1 Answers1

3

From the final error message //go:build comment without // +build comment, it looks one of the tools is expecting both the new //go:build and the old // +build build constraint styles. My guess is this is because your go.mod says you want to support a version of Go older than 1.18 (when // +build became obsolete) but this grpc-gateway package is written for Go 1.18 and only includes a //go:build style constraint.

Looking at the source of the file in question, it looks like it does only have a //go:build comment, but the go.mod says it should support Go 1.17. So it seems like that package is broken... in fact, looks like there's an open issue related to that. So you'll probably have to wait for them to fix it, use an older version that works, or use a replace in your own go.mod to use a fork.

I think this was broken a few days ago with the release of v2.10.2, when that fuzz file was added with the //go:build line and no // +build one.

Update: looks like this has been fixed in v2.10.3.

Ben Hoyt
  • 10,694
  • 5
  • 60
  • 84