Skip to content

Commit 4507935

Browse files
authored
Merge pull request #199 from lichuqiang/image_rollback
Add truncate options when opening files to overwrite contents in existing files
2 parents 833dc0f + 80d4d0e commit 4507935

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)