Skip to content

Commit

Permalink
fix: don't close file if create failed (influxdata#24366)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbainlive committed Sep 29, 2023
1 parent 26afe43 commit 741e73d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/influxd/inspect/type_conflicts/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ func (s Schema) WriteConflictsFile(filename string) error {

func (s Schema) encodeSchema(filename string) (rErr error) {
schemaFile, err := os.Create(filename)
defer errors2.Capture(&rErr, schemaFile.Close)()
if err != nil {
return fmt.Errorf("unable to create schema file: %w", err)
}
defer errors2.Capture(&rErr, schemaFile.Close)()
return s.Encode(schemaFile)
}

Expand Down

0 comments on commit 741e73d

Please sign in to comment.