Skip to content

docs: update goheader.template reference #5477

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

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

alexandear
Copy link
Member

@alexandear alexandear commented Feb 26, 2025

Reading the reference, I found that the goheader.template missed comments # when marking empty lines:

Details

Before:

    template: |-
      # Put here copyright header template for source code files
      # For example:
      # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
      #
      # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
      # SPDX-License-Identifier: Apache-2.0

      # 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.

After:

    template: |-
      # Put here copyright header template for source code files
      # For example:
      # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
      #
      # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
      # SPDX-License-Identifier: Apache-2.0
      #
      # 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.

But then I realized, why do we need to comment the example header at all? Better is to put copyright text right into the template, so that people can use it as is:

    # The template used for checking.
    # Put here copyright header template for source code files
    # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
    # Default: ""
    template: |-
      {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
      SPDX-License-Identifier: Apache-2.0

      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.

@alexandear alexandear force-pushed the docs/improve-goheader-template branch from 9b487ac to f967f98 Compare February 26, 2025 09:52
@ldez ldez self-requested a review February 26, 2025 11:58
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

@ldez ldez added the topic: cleanup Related to code, process, or doc cleanup label Feb 27, 2025
@ldez ldez merged commit c01a04b into golangci:master Feb 27, 2025
18 checks passed
@alexandear alexandear deleted the docs/improve-goheader-template branch February 27, 2025 12:05
@ldez ldez modified the milestones: unreleased, v1.64 Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs topic: cleanup Related to code, process, or doc cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants