Skip to content

Update licensing#590

Merged
danehans merged 7 commits intoenvoyproxy:mainfrom
youngnick:update-licensing
Oct 20, 2022
Merged

Update licensing#590
danehans merged 7 commits intoenvoyproxy:mainfrom
youngnick:update-licensing

Conversation

@youngnick
Copy link
Copy Markdown
Contributor

@youngnick youngnick commented Oct 18, 2022

This PR adds license headers and license checks as discussed in #92.
It also adds a CI check for license headers.

It's a pretty big PR, sorry, but I had to touch every single Go file in the repo.

I've left it to only Go files for now, the tool can do YAML files as well, but I figured this was big enough already.

Closes #92.

@youngnick youngnick requested a review from a team as a code owner October 18, 2022 07:35
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 18, 2022

Codecov Report

Merging #590 (c795233) into main (31e921e) will increase coverage by 0.27%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #590      +/-   ##
==========================================
+ Coverage   61.92%   62.20%   +0.27%     
==========================================
  Files          47       47              
  Lines        5742     5742              
==========================================
+ Hits         3556     3572      +16     
+ Misses       1958     1942      -16     
  Partials      228      228              
Impacted Files Coverage Δ
internal/cmd/certgen.go 12.82% <ø> (ø)
internal/cmd/root.go 100.00% <ø> (ø)
internal/cmd/server.go 7.62% <ø> (ø)
internal/cmd/versions.go 28.57% <ø> (ø)
internal/cmd/xdstest.go 3.65% <ø> (ø)
internal/crypto/certgen.go 77.21% <ø> (ø)
internal/envoygateway/config/config.go 0.00% <ø> (ø)
internal/envoygateway/config/decoder.go 70.00% <ø> (ø)
internal/gatewayapi/contexts.go 76.02% <ø> (ø)
internal/gatewayapi/helpers.go 66.38% <ø> (ø)
... and 39 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@youngnick youngnick force-pushed the update-licensing branch 5 times, most recently from 9145083 to e1a5f2b Compare October 18, 2022 07:56
Copy link
Copy Markdown
Contributor

@danehans danehans left a comment

Choose a reason for hiding this comment

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

@youngnick thanks for making this happen. I have a few nits throughout.

Comment thread api/config/v1alpha1/groupversion_info.go Outdated
Comment thread tools/boilerplate/boilerplate.generatego.txt Outdated
Comment thread tools/boilerplate/boilerplate.go.txt Outdated
Comment thread internal/provider/kubernetes/kubernetes.go Outdated
Comment thread tools/make/tools.mk Outdated
Comment thread tools/src/controller-gen/go.mod Outdated
Comment thread tools/boilerplate/boilerplate.py Outdated
Copy link
Copy Markdown
Contributor

@arkodg arkodg Oct 18, 2022

Choose a reason for hiding this comment

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

any way to reuse rather than copy code over and maintain ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not easily, no. This should need minimal maintenance though, since it's only using core python features, and already does everything we need.

Comment thread .github/workflows/build_and_test.yaml Outdated
Copy link
Copy Markdown
Contributor

@arkodg arkodg Oct 18, 2022

Choose a reason for hiding this comment

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

nit: if we have more of these, we should consider creating check and add licencse-check and gen-check under it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I went back and forth on breaking this out, but decided three should be the critical number. Does that seem okay?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sg thanks for sharing the thought process

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The GNU convention is that check runs the test suite.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On the other side, I'd argue that this should be part of the existing make lint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm going to leave this as-is for now, so that we can have proper licensing for our first big public release. I'm happy for targets to move around at a later date though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we're at the v0.2.0 release date, we can iterate to improve in v0.3.0.

Comment thread tools/src/golangci-lint/pin.go Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding these makes these imports not get removed by gofmt, so auto-format-on-save won't break them.

Copy link
Copy Markdown
Contributor

@LukeShu LukeShu Oct 19, 2022

Choose a reason for hiding this comment

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

gofmt won't remove them, but goimports (which is mostly a drop-in replacement for gofmt, and is what your auto-format-on-save is likely using) will.

Good change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But this is also going to require a change to the regex in tools.mk

-	cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) $$(sed -En 's,^import "(.*)".*,\1,p' pin.go)
+	cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) $$(sed -En 's,^import _ "(.*)".*,\1,p' pin.go)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, that'll teach me to work on this late. Adding the underscore breaks the whole tooling, Go doesn't consider the import relevant any more and so can't do go build, it seems. Sigh, I'll roll it back, no editing pin.go without using a separate editor for me.

Comment on lines 7 to 9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Surely the linter is complaining about all these extra newlines? (Because gofmt would remove them)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was an artifact of how controller-gen was working, fixed.

Comment thread internal/status/status.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is due to a change in gofmt from 1.18 to 1.19. This should be in a separate Go 1.19 PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted.

Comment thread tools/boilerplate/verify-boilerplate.sh Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The existing golangci-lint can do this too, https://golangci-lint.run/usage/linters/#goheader no need to introduce a bunch more Python and Bash.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, converted. There are now two places to update the boilerplate though, tools/linter/golangci-lint/.golangci.yml (golangci-lint config) and tools/boilerplate.txt (controller-gen template). The former expects no comment marks, while the latter requires them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After doing this and rebasing, there were two files missing headers, but the golangci-lint header check doesn't tell you the names, just that there are files missing headers, when it runs in Github Actions, anway. I spent about an hour poking at it, but I've reverted to boilerplate.py, since that actually has useful error messages.

If we want to change it later, that's fine, but someone else will need to have a crack.

@youngnick youngnick force-pushed the update-licensing branch 4 times, most recently from efbd344 to df00765 Compare October 20, 2022 00:11
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
@youngnick youngnick added this to the 0.2.0 milestone Oct 20, 2022
@danehans danehans merged commit cba9a5b into envoyproxy:main Oct 20, 2022
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.

Finalize License Header Management

5 participants