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

Rename Go module from github.com/vmware-tanzu/antrea to antrea.io/antrea #2166

Merged

Conversation

antoninbas
Copy link
Contributor

This is a pretty straightforward change with one exception: we cannot
use the default Protobuf package names for Antrea APIs because of name
resolution in protoc and because of how go-to-protobuf references
messages defined in other .proto files. go-to-protobuf will not add a
leading dot to the message path, and in that case protoc does resolution
starting from the inbermost scope. Default package names start with
"antrea.io.antrea." which means that for any message reference that
matches "antrea.io.antrea.", protoc will look for
"antrea.io.antrea.io.antrea." which obviously will fail. To avoid
a "sed" hack to add a leading dot (which would require us to run protoc
directly), we rename the package names to "antrea_io.antrea.*". Even
though this causes some extra code to be re-generated, there shouldn't
be any impact at all on backwards-compatibility: the Protobuf messages
themselves do not change.

Consumers of the Antrea Go module should update the import path they use
for Antrea. If these consumers are "pinning" a version of Antrea which
is on a release branch that was created before the repository transfer
(for now, all release branches...), their code should keep working.

See #2154

@antoninbas
Copy link
Contributor Author

BTW, I have already configured the antrea.io website to serve the HTML data required for the vanity import path to work.

@codecov-commenter
Copy link

codecov-commenter commented May 12, 2021

Codecov Report

Merging #2166 (628aa96) into main (429f230) will increase coverage by 4.21%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2166      +/-   ##
==========================================
+ Coverage   61.07%   65.28%   +4.21%     
==========================================
  Files         270      270              
  Lines       20486    20486              
==========================================
+ Hits        12512    13375     +863     
+ Misses       6672     5745     -927     
- Partials     1302     1366      +64     
Flag Coverage Δ
e2e-tests 56.36% <ø> (?)
kind-e2e-tests 52.09% <ø> (+0.18%) ⬆️
unit-tests 41.36% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/agent.go 54.39% <ø> (+6.88%) ⬆️
pkg/agent/apiserver/apiserver.go 69.11% <ø> (ø)
...g/agent/apiserver/handlers/addressgroup/handler.go 40.00% <ø> (ø)
pkg/agent/apiserver/handlers/agentinfo/handler.go 38.23% <ø> (ø)
...agent/apiserver/handlers/appliedtogroup/handler.go 40.00% <ø> (ø)
.../agent/apiserver/handlers/networkpolicy/handler.go 58.33% <ø> (ø)
pkg/agent/apiserver/handlers/ovsflows/handler.go 75.00% <ø> (ø)
pkg/agent/apiserver/handlers/ovstracing/handler.go 70.10% <ø> (ø)
...g/agent/apiserver/handlers/podinterface/handler.go 75.00% <ø> (ø)
pkg/agent/client.go 77.41% <ø> (ø)
... and 129 more

This is a pretty straightforward change with one exception: we cannot
use the default Protobuf package names for Antrea APIs because of name
resolution in protoc and because of how go-to-protobuf references
messages defined in other .proto files. go-to-protobuf will not add a
leading dot to the message path, and in that case protoc does resolution
starting from the inbermost scope. Default package names start with
"antrea.io.antrea." which means that for any message reference that
matches "antrea.io.antrea.<path>", protoc will look for
"antrea.io.antrea.io.antrea.<path>" which obviously will fail. To avoid
a "sed" hack to add a leading dot (which would require us to run protoc
directly), we rename the package names to "antrea_io.antrea.*". Even
though this causes some extra code to be re-generated, there shouldn't
be any impact at all on backwards-compatibility: the Protobuf messages
themselves do not change.

Consumers of the Antrea Go module should update the import path they use
for Antrea. If these consumers are "pinning" a version of Antrea which
is on a release branch that was created before the repository transfer
(for now, all release branches...), their code should keep working.

See antrea-io#2154
@antoninbas antoninbas force-pushed the rename-go-module-to-antrea.io/antrea branch from 1d6a315 to 628aa96 Compare May 12, 2021 03:17
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Member

tnqn commented May 12, 2021

/test-all

1 similar comment
@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas antoninbas merged commit e8ca544 into antrea-io:main May 12, 2021
@antoninbas antoninbas deleted the rename-go-module-to-antrea.io/antrea branch May 12, 2021 17:47
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