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

*: update to use full package name for option go_package in protos #97272

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

rickystewart
Copy link
Collaborator

@rickystewart rickystewart commented Feb 16, 2023

Everywhere in the entire tree we use option go_package statements like
the following:

option go_package = "build";

We do this instead of using the entire fully-qualified package name,
like:

option go_package = "github.com/cockroachdb/cockroach/pkg/build";

This is apparently just an error. All the documentation I have seen
(https://github.com/cockroachdb/gogoproto/blob/master/README) suggests
that the fully-qualified package name should be used here. Further, this
caused the make build to break after a refactor as the code generator
doesn't know how to import a package like "roachpb" (since it should
instead be importing "github.com/cockroachdb/cockroach/pkg/roachpb").

Correct this problem everywhere and update the Makefile to set
paths=source_relative to tell protoc that output files should be
placed next to input files.

Epic: none
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rickystewart rickystewart changed the title roachpb: update to use full package name for roachpb in go_package *: update to use full package name for option go_package in protos Feb 17, 2023
@rickystewart rickystewart force-pushed the roachpbgopackage branch 3 times, most recently from 900091a to 922bc37 Compare February 17, 2023 21:50
Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Out of sheer paranoia, I would double-check that the generated files show no other differences (like they would if we changed the proto package names).

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @healthy-pod)

@rickystewart
Copy link
Collaborator Author

Out of sheer paranoia, I would double-check that the generated files show no other differences (like they would if we changed the proto package names).

There are actually diffs in the FileDescriptorProto:

cockroach$ diff pkg/roachpb/internal.pb.go internal.pb.go 
207,235c207,233
< 	// 433 bytes of a gzipped FileDescriptorProto
< 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, .......

As far as I can tell this is because the go_package option is included in the actual FileDescriptorProto itself.

@rickystewart rickystewart marked this pull request as ready for review February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team February 21, 2023 17:49
@rickystewart rickystewart requested review from a team as code owners February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team February 21, 2023 17:49
@rickystewart rickystewart requested review from a team as code owners February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team as a code owner February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team February 21, 2023 17:49
@rickystewart rickystewart requested review from a team as code owners February 21, 2023 17:49
@rickystewart rickystewart requested a review from a team February 21, 2023 17:49
@rickystewart rickystewart requested review from a team as code owners February 21, 2023 17:49
@rickystewart rickystewart requested review from rhu713, bananabrick, shermanCRL and mgartner and removed request for a team February 21, 2023 17:49
@rickystewart
Copy link
Collaborator Author

PR still has some issues with code generation, I'll take care of that.

Everywhere in the entire tree we use `option go_package` statements like
the following:

```
option go_package = "build";
```

We do this *instead of* using the entire fully-qualified package name,
like:

```
option go_package = "github.com/cockroachdb/cockroach/pkg/build";
```

This is apparently just an error. All the documentation I have seen
(https://github.com/cockroachdb/gogoproto/blob/master/README) suggests
that the fully-qualified package name should be used here. Further, this
caused the `make` build to break after a refactor as the code generator
doesn't know how to import a package like `"roachpb"` (since it should
instead be importing `"github.com/cockroachdb/cockroach/pkg/roachpb"`).

Correct this problem *everywhere* and update the `Makefile` to set
`paths=source_relative` to tell `protoc` that output files should be
placed next to input files.

Epic: none
Release note: None
@rickystewart
Copy link
Collaborator Author

bors r=rail,stevendanna,RaduBerinde

@craig
Copy link
Contributor

craig bot commented Feb 22, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig craig bot merged commit 3a532ac into cockroachdb:master Feb 22, 2023
@craig
Copy link
Contributor

craig bot commented Feb 22, 2023

Build succeeded:

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 this pull request may close these issues.

5 participants