Skip to content

Commit

Permalink
linter: fix go-header check (#319)
Browse files Browse the repository at this point in the history
Starting with 2023 we started having false go-header positives.
This was due to two things:
1) we need to add history during the checkout, as the go-header linter
   checks if the header in the sources should include the current year
   using 'git log' (if it fails, would check the file stats, but that
   has been just checked out, so will match current year for sure).
2) the current golangci-lint v1.50.1 is more sensible to the yaml
   syntax, in particular to the curly braces: the parser will work
   correctly if the curly braces have a space before (and after) the
   expression to be evaluated.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
  • Loading branch information
fgiudici committed Jan 5, 2023
1 parent c4bb975 commit 43538d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/lint.yaml
Expand Up @@ -12,11 +12,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.17.x
- name: Analysis
uses: golangci/golangci-lint-action@v3
with:
args: -v
args: -v
2 changes: 1 addition & 1 deletion .golangci.yml
Expand Up @@ -19,7 +19,7 @@ linters-settings:
min-complexity: 20 # default is 30 which is too high
goheader:
template: |-
Copyright © {{year}} SUSE LLC
Copyright © {{ year }} SUSE LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 43538d1

Please sign in to comment.