@@ -7,32 +7,23 @@ import (
77 "image/draw"
88 "image/png"
99
10- "github.com/boombuler/barcode/code128"
11- "github.com/boombuler/barcode/ean"
12- "github.com/johnfercher/maroto/v2/pkg/consts/barcode"
13-
1410 libBarcode "github.com/boombuler/barcode"
11+ "github.com/boombuler/barcode/code128"
1512 "github.com/boombuler/barcode/datamatrix"
13+ "github.com/boombuler/barcode/ean"
1614 "github.com/boombuler/barcode/qr"
1715
16+ "github.com/johnfercher/maroto/v2/pkg/consts/barcode"
1817 "github.com/johnfercher/maroto/v2/pkg/consts/extension"
1918 "github.com/johnfercher/maroto/v2/pkg/core/entity"
2019 "github.com/johnfercher/maroto/v2/pkg/props"
2120)
2221
23- // codeInstance is the singleton of code, opted to use a singleton to ensure that
24- // this will not be instantiated more than once since there is no need to do this
25- // because code is stateless.
26- var codeInstance * code = nil
27-
2822type code struct {}
2923
3024// New create a Code (Singleton).
3125func New () * code {
32- if codeInstance == nil {
33- codeInstance = & code {}
34- }
35- return codeInstance
26+ return & code {}
3627}
3728
3829// GenDataMatrix is responsible to generate a data matrix byte array.
@@ -76,7 +67,9 @@ func (c *code) GenBar(code string, _ *entity.Cell, prop *props.Barcode) (*entity
7667 return c .getImage (scaledBarCode )
7768}
7869
79- func getBarcodeClosure (barcodeType barcode.Type ) func (code string ) (libBarcode.BarcodeIntCS , error ) {
70+ func getBarcodeClosure (
71+ barcodeType barcode.Type ,
72+ ) func (code string ) (libBarcode.BarcodeIntCS , error ) {
8073 switch barcodeType {
8174 case barcode .EAN :
8275 return ean .Encode
0 commit comments