diff options
-rw-r--r-- | cmd/podman/images/search.go | 18 | ||||
-rw-r--r-- | test/e2e/search_test.go | 1 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go index e4d325361..c8ea4b04a 100644 --- a/cmd/podman/images/search.go +++ b/cmd/podman/images/search.go @@ -26,6 +26,12 @@ type searchOptionsWrapper struct { Format string // For go templating } +// listEntryTag is a utility structure used for json serialization. +type listEntryTag struct { + Name string + Tags []string +} + var ( searchOptions = searchOptionsWrapper{} searchDescription = `Search registries for a given image. Can search all the default registries or a specific registry. @@ -189,11 +195,8 @@ func printJson(v interface{}) error { return nil } -func buildListTagsJson(searchReport []entities.ImageSearchReport) interface{} { - entries := []struct { - Name string - Tags []string - }{} +func buildListTagsJson(searchReport []entities.ImageSearchReport) []listEntryTag { + entries := []listEntryTag{} ReportLoop: for _, report := range searchReport { @@ -203,10 +206,7 @@ ReportLoop: continue ReportLoop } } - newElem := struct { - Name string - Tags []string - }{ + newElem := listEntryTag{ report.Name, []string{report.Tag}, } diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 4a04a88cd..1d86ae744 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -131,6 +131,7 @@ registries = ['{{.Host}}:{{.Port}}']` Expect(search.IsJSONOutputValid()).To(BeTrue()) Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine")) Expect(search.OutputToString()).To(ContainSubstring("3.10")) + Expect(search.OutputToString()).To(ContainSubstring("2.7")) }) It("podman search no-trunc flag", func() { |