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

Remove deprecated +build Go build tags #888

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

ti-mo
Copy link
Collaborator

@ti-mo ti-mo commented Dec 13, 2022

Does what it says on the tin, remove +build in favour of //go:build. To keep this straightforward, it uses a [][]string internally, and the template engine ORs all inner slices and ANDs all outer slices. This causes a clean diff with everything currently in examples/.

There's one problem: specifying multiple exclusions is currently a bit broken. -tags "!foo !bar" will result in //go:build (!foo || !bar), which cancels each other out. We could pick out all tags starting with ! and render them out to a separate clause that's ANDed?

@lmb let me know what you think.

@ti-mo ti-mo requested a review from lmb December 13, 2022 11:26
@ti-mo ti-mo marked this pull request as ready for review January 13, 2023 10:00
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
To follow suit with the new //go:build convention of build tags, this commit
converts bpf2go to no longer emit the deprecated +build lines.

The bpf2go command line interface remains unchanged to avoid breaking users.
In the future we can introduce a new -constraints flag and deprecate -tags.

Signed-off-by: Timo Beckers <timo@isovalent.com>
Co-developed-by: Lorenz Bauer <oss@lmb.io>
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

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

I've changed your commit so that we don't emit new build lines, but stick to the old command line interface. PTAL.

@@ -14,4 +14,6 @@ KeepEmptyLinesAtTheStartOfBlocks: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
ColumnLimit: 1000
# Go compiler comments need to stay unindented.
CommentPragmas: '^go:.*'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting!

@ti-mo ti-mo merged commit a8362ae into cilium:master Feb 14, 2023
@ti-mo ti-mo deleted the tb/new-go-build-tags branch February 14, 2023 07:44
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.

2 participants