Skip to content

Commit

Permalink
removed unnecessary Close call and formatted map hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Dec 4, 2023
1 parent 41dcd9b commit cdfc1f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion tools/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ func (s *System) CreateThumb(originalKey string, thumbKey, thumbSize string) err
return decodeErr
}

r.Close()
var thumbImg *image.NRGBA

if width == 0 || height == 0 {
Expand Down
13 changes: 7 additions & 6 deletions tools/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ func (s *Store[T]) Reset(newData map[string]T) {
s.mux.Lock()
defer s.mux.Unlock()

var clone = make(map[string]T, len(newData))

for k, v := range newData {
clone[k] = v
if len(newData) > 0 {
s.data = make(map[string]T, len(newData))
for k, v := range newData {
s.data[k] = v
}
} else {
s.data = make(map[string]T)
}

s.data = clone
}

// Length returns the current number of elements in the store.
Expand Down

0 comments on commit cdfc1f7

Please sign in to comment.