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

YAML multiline string without "block chomping" for config go-header linter causes golangci-lint to fail #6

Closed
svengreb opened this issue Sep 21, 2020 · 0 comments · Fixed by #7

Comments

@svengreb
Copy link
Owner

The configuration of the go-header linter is defined in the golangci-lint YAML configuration, but the YAML multiline-string doesn't uses "block chomping which results in a final newline at the end of the template.

-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 match the parsed text.
To fix this problem the YAML block chomping syntax must be used for the multiline-string so that the final newline at the end gets stripped:

-template: |
+template: |-
@svengreb svengreb added this to the Next milestone Sep 21, 2020
@svengreb svengreb self-assigned this Sep 21, 2020
svengreb added a commit that referenced this issue Sep 21, 2020
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

GH-6
svengreb added a commit that referenced this issue Sep 21, 2020
…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
@svengreb svengreb removed their assignment Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant