Force replace go_package declaration #114
Merged
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.
Motivation
Since we are implementing Go module, Go always look the package declared in go_package on remote resource, even though the generated .pb files is in local. In order to make go mod look for the package in local path, we need to do
go mod init
for each package. It is very hard to do that since we don't know the root path of each package. Not only that, we need to put a replace statement in go.mod file neighboring server.go. (#105)Forcing the go_package declaration under gripmock/protogen folder makes it easier for go to locate the intended package, the only thing we do is a single replace statement in go.mod file in gripmock root path.
Another reason for forcing the value update is that non Go user has no reason to put go_package in their proto other than to be used in gripmock. Even if they do, they don't know what is the right value to put in it. (#93, #99)
Changelist