Skip to content

Commit 9072441

Browse files
authored
Merge pull request tinkerbell#20 from tstromberg/remove-leading-whitespace
Trim leading whitespace when creating a new Makefile
2 parents 9df7dfc + 8ea1f2f commit 9072441

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Makefile

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# BEGIN: lint-install .
32
# http://github.com/tinkerbell/lint-install
43

lint-install.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ func updateMakefile(root string, cfg Config, dryRun bool) (string, error) {
122122
proposed = append(proposed, newRules.Bytes()...)
123123
}
124124

125-
// trim any accidental trailing newlines
125+
// Trim extraneous newlines
126+
if len(existing) == 0 {
127+
proposed = bytes.TrimLeft(proposed, "\n")
128+
}
126129
proposed = bytes.TrimRight(proposed, "\n")
127130
proposed = append(proposed, byte('\n'))
128131

0 commit comments

Comments
 (0)