Go package cannot handle .proto
files in nested subdirectories that do not contain .go
files
#115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm using a PR here to describe the issue so that we can comment/discuss the reproduction code if necessary.
Continuing on from #114, this is a reproduction of the bug we hit in a multi-language repo that has
.proto
files. In the repo in question, we're trying to achieve having a single.proto
file that's used to generate code for a Go server, and a Kotlin client.The only way we were able to achieve this was to let an IDE handle the code generation on the Kotlin side, which necessitates having the
.proto
file in a specific path within the repo. We used a symlink from this path back to the.proto
file at the root of the repo so that we only need to make updates in a single.proto
file.We use both the
protobuf
andgo
packages to handle the Go side of the generation, but something about this setup breaks thego
package. When you runmake precommit
for example, you will get an error like:What's extra weird is that this only seems to happen when the
.proto
file is in a nested directory (e.g.lib/src
as opposed to justlib
). The problem also occurs regardless of whether the.proto
file is symlinked or copied.Prior to merging #114, we also found that running
make generate
would generate the Go code from the.proto
file at the root of the repo, then overwrite that generated code with another version generated from the symlinked version of the.proto
file. Since the generated code includes some stuff that's affected by the path, it was also causing diff churn and potentially other problems in the generated Go code.Not sure what the best way to proceed is here, and I feel out of my depth a bit with the way the go package works. But I think maybe we need:
.proto
files in any depth of directory is fine and doesn't break Go builds.