Skip to content

Commit

Permalink
ensure existing files get truncated when generating files
Browse files Browse the repository at this point in the history
  • Loading branch information
lichuqiang committed May 22, 2018
1 parent e4f95e9 commit 80d4d0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/kubebuilder/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func WriteString(path, value string) {
create(path)
}

f, err := os.OpenFile(path, os.O_WRONLY, 0)
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0)
if err != nil {
log.Fatalf("Failed to create %s: %v", path, err)
}
Expand Down

0 comments on commit 80d4d0e

Please sign in to comment.