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

License checker and license update #254

Closed
wants to merge 7 commits into from
Closed

License checker and license update #254

wants to merge 7 commits into from

Conversation

Bez625
Copy link
Collaborator

@Bez625 Bez625 commented Sep 18, 2024

Hi @mcdee

I wanted to get your thoughts on this. Essentially 2 changes:

  • Add a github action that ensures the expected license is present on all go files (the license is defined in .licenserc.json).
  • A golang script that will use the template from .licenserc.json and update all go files to match.

Perhaps the second part is more of a generic tool that we want to store somewhere else and use as a binary across multiple repos, but I thought I'd open the change and get your feedback first.

I did run the updater as part of the PR and it's created a lot of changes, but I'm hoping with the github action enforcing new changes then we would only have to run this once per year to update to the current year.

@Bez625 Bez625 changed the title Test license checker License checker and license update Sep 19, 2024
@Bez625 Bez625 marked this pull request as ready for review September 27, 2024 11:34
@Bez625 Bez625 requested a review from mcdee September 27, 2024 11:34
@mcdee
Copy link
Contributor

mcdee commented Oct 10, 2024

Regarding a license check, there is a goheader linter that can be enabled in .golangci-lint.yml, e.g.:

linters-settings:
  goheader:
    values:
      regexp:
        YEARS: '(20\d\d|20\d\d, 20\d\d|20\d\d - 20\d\d)'
    template: |-
      Copyright © {{ YEARS }} Attestant Limited.
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

I'm also not sure about the update process, because it resets the copyright date to the current year. Copyright starts with the date of first implementation, with (optionally) additional years added when there are major updates. I think that as long as we have the linter in place the update isn't necessary.

@Bez625
Copy link
Collaborator Author

Bez625 commented Oct 10, 2024

That's a far cleaner solution - I'll look at getting it in place.

@Bez625 Bez625 closed this Oct 10, 2024
@Bez625 Bez625 deleted the update_license branch October 10, 2024 16:16
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