Skip to content

Commit

Permalink
Merge pull request #11 from go-spectest/truncate-index
Browse files Browse the repository at this point in the history
Truncate index file when open file
  • Loading branch information
nao1215 authored Nov 4, 2023
2 parents df194ee + 671b48b commit 7ab8e22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (i *Index) walk() error {
func (i *Index) write() (err error) {
if i.w == nil {
const readUserOnly = 0600
if i.w, err = os.OpenFile(filepath.Clean(filepath.Join(i.targetDir, "index.md")), os.O_WRONLY|os.O_CREATE, readUserOnly); err != nil {
if i.w, err = os.OpenFile(filepath.Clean(filepath.Join(i.targetDir, "index.md")), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, readUserOnly); err != nil {
return err
}
}
Expand Down

0 comments on commit 7ab8e22

Please sign in to comment.