From 5993a8b1711483792d1370a7b5787bd1392d32c2 Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Sun, 9 Dec 2018 19:30:13 +0200 Subject: [PATCH] remove redundant types in literals --- common/license/util.go | 2 +- pdf/creator/toc_line.go | 4 ++-- pdf/internal/cmap/cmap.go | 2 +- pdf/model/font_test.go | 44 +++++++++++++++++++-------------------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/common/license/util.go b/common/license/util.go index d80d5f0b..9ddba152 100644 --- a/common/license/util.go +++ b/common/license/util.go @@ -12,7 +12,7 @@ import ( ) // Defaults to the open source license. -var licenseKey *LicenseKey = MakeUnlicensedKey() +var licenseKey = MakeUnlicensedKey() // Sets and validates the license key. func SetLicenseKey(content string, customerName string) error { diff --git a/pdf/creator/toc_line.go b/pdf/creator/toc_line.go index 7a56d8a4..0e98a170 100644 --- a/pdf/creator/toc_line.go +++ b/pdf/creator/toc_line.go @@ -156,11 +156,11 @@ func (tl *TOCLine) prepareParagraph(sp *StyledParagraph, ctx DrawContext) { sp.chunks = []*TextChunk{ &tl.Number, - &TextChunk{ + { Text: title, Style: tl.Title.Style, }, - &TextChunk{ + { Text: page, Style: tl.Page.Style, }, diff --git a/pdf/internal/cmap/cmap.go b/pdf/internal/cmap/cmap.go index ec813e15..16312e75 100644 --- a/pdf/internal/cmap/cmap.go +++ b/pdf/internal/cmap/cmap.go @@ -68,7 +68,7 @@ func NewToUnicodeCMap(codeToUnicode map[CharCode]rune) *CMap { Ordering: "UCS", Supplement: 0, }, - codespaces: []Codespace{Codespace{Low: 0, High: 0xffff}}, + codespaces: []Codespace{{Low: 0, High: 0xffff}}, codeToUnicode: codeToUnicode, } } diff --git a/pdf/model/font_test.go b/pdf/model/font_test.go index e3d75b37..4e028c5d 100644 --- a/pdf/model/font_test.go +++ b/pdf/model/font_test.go @@ -113,7 +113,7 @@ func TestNewStandard14Font(t *testing.T) { fonts.CharMetrics } tests := map[model.Standard14Font]expect{ - "Courier": expect{ + "Courier": { subtype: "Type1", basefont: "Courier", CharMetrics: fonts.CharMetrics{Wx: 600, Wy: 0}}, @@ -249,7 +249,7 @@ func TestCharcodeBytesToUnicode(t *testing.T) { } var charcodeBytesToUnicodeTest = []fontFragmentTest{ - fontFragmentTest{"Helvetica built-in", + {"Helvetica built-in", "./testdata/font/simple.txt", 1, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, @@ -267,7 +267,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ "abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹OEŽ‘’“”•–—˜™š›oežŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·" + "¸¹º»¼½¾¿ÀÁÂÃÄÅAEÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞfzàáâãäåaeçèéêëìíîïðñòóôõö÷øùúûüýþÿ", }, - fontFragmentTest{"Symbol built-in", + {"Symbol built-in", "./testdata/font/simple.txt", 3, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, @@ -281,7 +281,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ " !∀#∃%&∋()∗+,−./0123456789:;<=>?≅ΑΒΧ∆ΕΦΓΗΙϑΚΛΜΝΟΠΘΡΣΤΥςΩΞΨΖ[∴]⊥_αβχδεφγηιϕκλµνοπθρστυϖω" + "ξψζ{|}∼€ϒ′≤⁄∞ƒ♣♦♥♠↔←↑→↓°±″≥×∝∂•÷≠≡≈…↵ℵℑℜ℘⊗⊕∅∩∪⊃⊇⊄⊂⊆∈∉∠∇∏√⋅¬∧∨⇔⇐⇑⇒⇓◊〈∑〉∫⌠⌡", }, - fontFragmentTest{"ZapfDingbats built-in", + {"ZapfDingbats built-in", "./testdata/font/simple.txt", 4, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, @@ -297,7 +297,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ "❘❙❚❛❜❝❞❡❢❣❤❥❦❧♣♦♥♠①②③④⑤⑥⑦⑧⑨⑩❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔→↔↕" + "➘➙➚➛➜➝➞➟➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯➱➲➳➴➵➶➷➸➹➺➻➼➽➾", }, - fontFragmentTest{"MacRoman encoding", + {"MacRoman encoding", "./testdata/font/axes.txt", 10, []byte{32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, @@ -315,7 +315,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ "abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶fz®©™´¨≠AEØ∞" + "±≤≥¥µ∂∑∏π∫ªºΩaeø¿¡¬√ƒ≈∆«»…ÀÃÕOEoe–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", }, - fontFragmentTest{"Test beginbfchar and beginbfrange cmap entries", + {"Test beginbfchar and beginbfrange cmap entries", "./testdata/font/Yemeni.txt", 470, []byte{0x1, 0xa8, 0x1, 0xb3, 0x1, 0xc2, 0x1, 0xcc, 0x1, 0xe7, 0x1, 0xef, 0x1, 0xf3, 0x0, 0x20, 0x1, 0xa2, 0x1, 0xfc, 0x2, 0x8, 0x1, 0xa6, 0x1, 0xe7, 0x0, 0x20, 0x2, 0xb, 0x0, @@ -323,30 +323,30 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ 0xcf, 0x0, 0xd0, 0x0, 0xd1, 0x1, 0xa1, 0x0, 0x20, 0x1, 0xa9, 0x2, 0x1}, "ﺔﺟﺮﺸﻓﻛﻟ ﺎﻨﻴﺒﻓ ﻷ ﻻ ﻉ ٠١٢٣٤ﺍ ﺕﻭ", }, - fontFragmentTest{"TrueType font with ToUnicode cmap", + {"TrueType font with ToUnicode cmap", "./testdata/font/print_alerts.txt", 9, []byte{43, 40, 41, 34, 37, 42, 38, 49, 36, 38, 48, 34, 35, 36, 37, 35, 36, 58}, "Alerts on printing", }, - fontFragmentTest{"Type0 font with ToUnicode cmap", + {"Type0 font with ToUnicode cmap", "./testdata/font/CollazoBio.txt", 7, []byte{255, 50, 255, 65, 255, 78, 255, 68, 255, 79, 255, 77, 0, 32, 0, 32, 255, 77, 255, 65, 255, 84, 255, 82, 255, 73, 255, 67, 255, 69, 255, 83, 0, 46}, "Random matrices.", }, - fontFragmentTest{"Type1 font with FontFile entry", + {"Type1 font with FontFile entry", "./testdata/font/lm.txt", 7, []byte{102, 65, 106, 66, 103}, "{A|B}", }, - fontFragmentTest{"Type1 font with /Encoding with /Differences", + {"Type1 font with /Encoding with /Differences", "./testdata/font/noise-invariant.txt", 102, []byte{96, 247, 39, 32, 147, 231, 148, 32, 232, 32, 193, 111, 180, 32, 105, 116, 169, 115, 32, 204, 195, 196, 197, 198, 199, 168, 202, 206, 226, 234, 172, 244, 173, 151, 177, 151, 178, 179, 183, 185, 188, 205, 184, 189}, "‘ł’ “Ł” Ø `o´ it's ˝ˆ˜¯˘˙¨˚ˇªº‹ı›—–—†‡•„…˛¸‰", }, - fontFragmentTest{"base glyphs′", + {"base glyphs′", "./testdata/font/cover.txt", 11, []byte{44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 65, 66, 67, 68, 69, 70, 71, 72, @@ -355,53 +355,53 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ 114, 115, 116, 117}, ",-.01235678:;ABCDEFGHTUabcdefghijlmnorstu", }, - fontFragmentTest{"tex glyphs 48->′", + {"tex glyphs 48->′", "./testdata/font/noise-contrast.txt", 36, []byte{33, 48, 65, 104, 149, 253}, "!′Ah•ý", }, - fontFragmentTest{"tex2 glyphs ", + {"tex2 glyphs ", "./testdata/font/Weil.txt", 30, []byte{55, 0, 1, 2, 20, 24, 33, 50, 102, 103, 104, 105}, "↦−·×≤∼→∈{}⟨⟩", }, - fontFragmentTest{"additional glyphs", + {"additional glyphs", "./testdata/font/noise-contrast.txt", 34, []byte{32, 40, 48, 64, 80, 88, 65, 104, 149, 253}, "({∑∑h•ý", }, - fontFragmentTest{".notdef glyphs", + {".notdef glyphs", "./testdata/font/lec10.txt", 6, []byte{59, 66}, string([]rune{textencoding.MissingCodeRune, textencoding.MissingCodeRune}), }, - fontFragmentTest{"Numbered glyphs pattern 1", + {"Numbered glyphs pattern 1", "./testdata/font/v14.txt", 14, []byte{24, 25, 26, 27, 29}, " ffifflfffi", }, - fontFragmentTest{"Glyph aliases", + {"Glyph aliases", "./testdata/font/townes.txt", 10, []byte{2, 3, 4, 5, 6, 7, 1, 8, 9, 5, 1, 10, 9, 5, 48}, "Townes van Zan…", }, - fontFragmentTest{"Glyph `.` extensions. e.g. `integral.disp`", + {"Glyph `.` extensions. e.g. `integral.disp`", "./testdata/font/preview.txt", 156, []byte{83, 0, 4, 67, 62, 64, 100, 65}, "∫=≈≥∈", }, - fontFragmentTest{"A potpourri of glyph naming conventions", + {"A potpourri of glyph naming conventions", "./testdata/font/Ingmar.txt", 144, []byte{18, 20, 10, 11, 13, 14, 15, 16, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 12, 17, 19, 24}, "ʼ8ČŽĆřćĐĭűőftffiflfffičž!fbfkffl\u00a0", }, - fontFragmentTest{"Zapf Dingbats", + {"Zapf Dingbats", "./testdata/font/estimation.txt", 122, []byte{2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14}, "✏✮✁☛❄❍❥❇◆✟✙", }, - fontFragmentTest{"Found these by trial and error", + {"Found these by trial and error", "./testdata/font/helminths.txt", 19, []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -410,7 +410,7 @@ var charcodeBytesToUnicodeTest = []fontFragmentTest{ 75, 76, 77}, " *ﺏﻁﻝﺍﺔﻴﻠﻜ،ﺕﺭﺘﻌﻤﺎﺠﻲﻨﻘﺩﻬ/ﻙﻭﻕﺃﻡﻋﻓﺴ٢٠٣ﻯﻥﺒﺸﺌﺱﻷ,ﺯﺤﺄﻀـﺓﺫ.)٤(٩ل٥٧٨ﻸﻰ%١ﺇ٦ﺡﻫﻱﻅﻐﺼﻑﺨﺀﻊLM", }, - fontFragmentTest{"Tesseract", + {"Tesseract", "./testdata/font/tesseract.txt", 3, []byte{0, 65, 0, 97, 1, 2, 1, 65, 1, 97,