Skip to content

Commit

Permalink
add err handling
Browse files Browse the repository at this point in the history
Signed-off-by: bupd <[email protected]>
  • Loading branch information
bupd committed Jul 3, 2024
1 parent 20bef9c commit b3c9149
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/store/in-memory-store.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ func (s *inMemoryStore) handleFileSource(ctx context.Context, imageList []Image)
}
}
if !found {
s.RemoveImage(ctx, image)
if err := s.RemoveImage(ctx, image); err != nil {
return false, err
}
change = true
}
}
Expand Down Expand Up @@ -206,8 +208,14 @@ func (s *inMemoryStore) Add(ctx context.Context, digest string, image string) er
}
}

// Add the image to the store
func (s *inMemoryStore) AddImage(ctx context.Context, image string) {
// Add the image to the store
if _, exists := s.images[image]; exists {
fmt.Printf(
"Warning: Image %s already exists in the store. Proceeding with the addition.\n",
image,
)
}
s.images[image] = ""
fmt.Printf("Added image: %s\n", image)
}
Expand Down

0 comments on commit b3c9149

Please sign in to comment.