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 copyright year in generated code #74

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

nojnhuh
Copy link
Contributor

@nojnhuh nojnhuh commented Jan 14, 2025

Since the Makefile instructs controller-gen to inject the current year into the code it generates, the turn of the calendar has caused it to become out of date. Alternatively, we could remove the year entirely to keep from having to do this annually:

object:headerFile=$(CURDIR)/hack/boilerplate.go.txt,year=$(shell date +"%Y") \

* Copyright YEAR The Kubernetes Authors.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 14, 2025
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2025
@byako
Copy link
Contributor

byako commented Jan 16, 2025

The generated code would get new year if there was a change in the code. If we want to keep copyright year up to date even in files that were not changed since last year - would you consider also updating the year in the rest of the files?

Anyone knows what's the policy in general? I have been updating copyright year to current only in files that are were changed in the current year.

@pohly
Copy link
Contributor

pohly commented Jan 16, 2025

The usual approach in Kubernetes is to set the copyright year the first time that a file gets created and then not update it again later, not even when editing the file.

Instead of injecting a varying year, I would copy some fixed year from the input files into the generated files - but I haven't looked into details here.

@nojnhuh
Copy link
Contributor Author

nojnhuh commented Jan 21, 2025

It seems the pattern at least in k/k is to omit the copyright year in generated code, so I applied that here as well.

s/Update/Remove/:

/retitle Remove copyright year in generated code

@k8s-ci-robot k8s-ci-robot changed the title Update copyright year in generated code Remove copyright year in generated code Jan 21, 2025
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 21, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hack/boilerplate.go.txt is no longer referenced, but I left it in the repo in case that's useful for when something like a make verify-boilerplate target is introduced. Happy to remove it though now if we only want to add it back once we need it.

Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 19, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: klueska, nojnhuh, pohly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit f41a589 into kubernetes-sigs:main Feb 19, 2025
6 checks passed
MaskerPRC pushed a commit to cosdt/ascend-dra-driver that referenced this pull request Feb 21, 2025
…year"

This reverts commit f41a589, reversing
changes made to 892b7d0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants