Skip to content

Commit 6fb050a

Browse files
authored
Remove duplicate empty line at EOF of values_types (openshift-service-mesh#548)
There's a bug in golangci-lint that causes a panic on double empty lines at EOF. Patching the golangci-lint version in another PR. Signed-off-by: Daniel Grimm <[email protected]>
1 parent eb1f7e8 commit 6fb050a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

api/v1alpha1/values_types.gen.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/api_transformer/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,14 @@ func removeLeadingEmptyLinesFromStructs(str string) string {
761761

762762
lines := strings.Split(str, "\n")
763763
var prevTrimmedLine string
764-
for _, line := range lines {
764+
for index, line := range lines {
765765
trimmedLine := strings.TrimSpace(line)
766766
skipLine := trimmedLine == "" && strings.HasSuffix(prevTrimmedLine, "struct {")
767767
if !skipLine {
768768
sb.WriteString(line)
769-
sb.WriteString("\n")
769+
if index < len(lines)-1 {
770+
sb.WriteString("\n")
771+
}
770772
}
771773
prevTrimmedLine = trimmedLine
772774
}

0 commit comments

Comments
 (0)