Skip to content

Commit 80d4d0e

Browse files
committed
ensure existing files get truncated when generating files
1 parent e4f95e9 commit 80d4d0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/kubebuilder/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func WriteString(path, value string) {
8484
create(path)
8585
}
8686

87-
f, err := os.OpenFile(path, os.O_WRONLY, 0)
87+
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0)
8888
if err != nil {
8989
log.Fatalf("Failed to create %s: %v", path, err)
9090
}

0 commit comments

Comments
 (0)