Skip to content

Commit

Permalink
Fix YAML multiline-string without "block chomping" for go-header lint…
Browse files Browse the repository at this point in the history
…er (#7)

The configuration of the go-header [1] linter is defined in the
golangci-lint [2] YAML configuration, but the YAML multiline-string [3]
doesn't used "block chomping [4] which resulted in a final newline at
the end of the template.

```diff
-This source code is licensed under the MIT license found in the LICENSE file.\n
+This source code is licensed under the MIT license found in the LICENSE file.
```

This causes golangci-lint to fail because the configured template
content doesn't matched the parsed text.
To fix this problem the YAML "block chomping" syntax is now used for the
multiline-string so that the final newline at the end gets stripped.

[1]: https://github.com/denis-tingajkin/go-header
[2]: https://github.com/golangci/golangci-lint
[3]: https://yaml-multiline.info
[4]: https://yaml.org/spec/1.2/spec.html#id2794534

Fixes GH-6
  • Loading branch information
svengreb committed Sep 21, 2020
1 parent cb87203 commit 910c06f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ linters-settings:
YEAR: 2020-present
regexp:
EMAIL: .*@svengreb\.de
template: |
template: |-
Copyright (c) {{ YEAR }} {{ AUTHOR }} <{{ EMAIL }}>
This source code is licensed under the MIT license found in the LICENSE file.
Expand Down

0 comments on commit 910c06f

Please sign in to comment.