From 782115a91624d28f8c2ada65d3d6aa776862f109 Mon Sep 17 00:00:00 2001 From: Felipe Amaral Date: Tue, 12 Sep 2023 09:57:38 -0300 Subject: [PATCH] fix broken accepted search on types --- cmd/main.go | 1 - go.mod | 2 +- pkg/v2/types.go | 8 ++++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 92831dc3..4888fce2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -14,7 +14,6 @@ func main() { header := buildRow() //content := buildRow() //footer := buildRow() - pdf.Add(header /*content, footer*/) err := pdf.Generate("v2.pdf") diff --git a/go.mod b/go.mod index cd133d47..20012a97 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/johnfercher/maroto -go 1.13 +go 1.18 require ( github.com/boombuler/barcode v1.0.1 diff --git a/pkg/v2/types.go b/pkg/v2/types.go index 1ddc2d71..f793ae57 100644 --- a/pkg/v2/types.go +++ b/pkg/v2/types.go @@ -1,5 +1,7 @@ package v2 +import "slices" + const ( Document = "document" Row = "row" @@ -16,8 +18,10 @@ func (t DocumentType) String() string { } func (t DocumentType) Accept(dt string) bool { - _, ok := buildAcceptedMap()[dt] - return ok + if val, ok := buildAcceptedMap()[t.String()]; ok { + return slices.Contains(val, dt) + } + return false } func buildAcceptedMap() map[string][]string {