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

Upgrade licenses #812

Merged
merged 1 commit into from
Dec 21, 2021
Merged

Upgrade licenses #812

merged 1 commit into from
Dec 21, 2021

Conversation

kuritka
Copy link
Collaborator

@kuritka kuritka commented Dec 20, 2021

  • update .licignore to contain /terratests, main.go, and gslb_controller.go.
  • remove old license from source code and terratests
  • place license on the new place in the go files (under package *\n)
  • update build pipeline (build.yml)
  • bump golic to v0.7.2
# golic@v0.5.0
golic remove -t apache2
# golic@v0.7.2
golic inject -t apache2

Signed-off-by: kuritka kuritka@gmail.com

- update .licignore to contain terratests, main.go, and gslb_controller.goe.
- remove old license from source code and terratests
- place license on the new place in the go files  (under package *\n)
- update build pipeline (`build.yml`)
- bump golic to v0.7.2
```shell
golic remove -t apache2
golic inject -t apache2
```

Signed-off-by: kuritka <kuritka@gmail.com>
@@ -1,3 +1,9 @@
// Code generated by MockGen. DO NOT EDIT.
Copy link
Member

Choose a reason for hiding this comment

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

so if we re-run the mock generation, is it going to be ok w/ golic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, it always inject license into it, see: https://github.com/k8gb-io/k8gb/blob/master/Makefile#L374

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

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

place license on the new place in the go files (under package *\n)

curious about this change. Was it breaking something with the license header before package?

@kuritka
Copy link
Collaborator Author

kuritka commented Dec 20, 2021

@ytsarev, thx for question.

A valid go file structure can be :

 /* 
   optional comment
 */
 
 // Package xyz optional comment,  if it exists, it must start with 'Package xyz' otherwise linters may shout. e.g: idea goland always warns. 
 package xyz
 ...

the problem starts when go directives are introduced, which must be in a certain place in the file - for example at the beginning:

//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// ^^ directives must be on the top...
// Package xyz defines....
package xyz

In such case, finding a place to inject the licence is more difficult.

finding a place for the license would be significantly harder, but not impossible:

  • Either we would have to specify files in k8gb/.golic.yaml that would generate the license under //go:build clauses (otherwise on top). With new files, we would have to edit the file from time to time.
  • Or edit golic again and iterate through the comments preceding the package definition until a space is found between the comments and the GO directives.

@ytsarev
Copy link
Member

ytsarev commented Dec 21, 2021

@kuritka that makes total sense, thanks for the explanation

@kuritka kuritka merged commit 910c5dc into master Dec 21, 2021
@kuritka kuritka deleted the golic-update branch December 21, 2021 13:54
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.

3 participants