From 4ef6ccee226c1c79e5bac8a5dc05af980a7420e0 Mon Sep 17 00:00:00 2001 From: Saman Hosseini Date: Sun, 25 Sep 2022 01:13:42 +0200 Subject: [PATCH] refactor(api/proto): optimize --- Makefile | 1 + api/proto/gen/gallery/v0/gallery.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d6bda10..1caa437 100644 --- a/Makefile +++ b/Makefile @@ -5,4 +5,5 @@ generate: .PHONY: test test: @go test -v ./... + @go test -v ./api/proto/... @go test -v ./goes/esgallery/... diff --git a/api/proto/gen/gallery/v0/gallery.go b/api/proto/gen/gallery/v0/gallery.go index 91ae0f4..fda6f0f 100644 --- a/api/proto/gen/gallery/v0/gallery.go +++ b/api/proto/gen/gallery/v0/gallery.go @@ -38,16 +38,16 @@ func NewStack[StackID, ImageID gallery.ID](s gallery.Stack[StackID, ImageID]) *S return &Stack{ Id: s.ID.String(), Variants: slicex.Map(s.Variants, NewVariant[ImageID]), - Tags: slicex.Ensure(s.Tags), + Tags: s.Tags, } } func AsStack[StackID, ImageID gallery.ID](s *Stack, toStackID func(string) StackID, toImageID func(string) ImageID) gallery.Stack[StackID, ImageID] { return gallery.Stack[StackID, ImageID]{ ID: toStackID(s.GetId()), - Variants: slicex.Map(s.GetVariants(), func(img *Image) gallery.Image[ImageID] { + Variants: slicex.Ensure(slicex.Map(s.GetVariants(), func(img *Image) gallery.Image[ImageID] { return AsImage(img, toImageID) - }), + })), Tags: slicex.Ensure(s.GetTags()), } }