Skip to content

Commit

Permalink
for sure close the reader
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ committed Feb 23, 2024
1 parent 6351f69 commit 0689096
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions internal/pkg/agent/storage/store/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,12 @@ func migrateYAMLStateStoreToStateStoreV1(store storage.Storage) error {
}

st, err := readState(reader)
defer reader.Close()
if err == nil {
// it's a valid JSON, therefore nothing to migrate
return nil
}

err = reader.Close()
if err != nil {
return fmt.Errorf("could not close store reader: %w", err)
}

// Try to read the store as YAML
yamlStore, err := migrations.LoadYAMLStateStore(store)
if err != nil {
Expand Down

0 comments on commit 0689096

Please sign in to comment.