From 3d8dbde4bca6165bd8f579917c9f08efa0c8d0a9 Mon Sep 17 00:00:00 2001 From: Taco de Wolff Date: Tue, 18 Jul 2023 13:29:21 +0200 Subject: [PATCH] gofmt -s --- cmd/pdftext/conv.go | 1 + cmd/pdftext/main.go | 2 +- cmd/pdftext/writer.go | 2 +- examples/html-canvas/main.go | 2 +- examples/html-canvas/serve.go | 2 +- examples/opengl/main.go | 2 +- font/sfnt_cff.go | 2 +- latex_bin.go | 13 +++++++------ latex_bin_test.go | 2 +- renderers/htmlcanvas/htmlcanvas.go | 2 +- renderers/opengl/opengl.go | 2 +- resources/preview/main.go | 2 -- text/fribidi.go | 2 +- text/fribidi_cgo.go | 2 +- text/harfbuzz.go | 1 - text/harfbuzz_cgo.go | 2 +- 16 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cmd/pdftext/conv.go b/cmd/pdftext/conv.go index e220239f..11fb604d 100644 --- a/cmd/pdftext/conv.go +++ b/cmd/pdftext/conv.go @@ -1,4 +1,5 @@ //go:build exclude + package main import ( diff --git a/cmd/pdftext/main.go b/cmd/pdftext/main.go index 6f27854e..731a5190 100644 --- a/cmd/pdftext/main.go +++ b/cmd/pdftext/main.go @@ -217,7 +217,7 @@ func getObjects(pdf *pdfReader, page int) ([]string, []interface{}) { resources, _ := pdf.GetDict(dict["Resources"]) xobjects, _ := pdf.GetDict(resources["XObject"]) xnames := []string{} - for name, _ := range xobjects { + for name := range xobjects { xnames = append(xnames, name) } sort.Strings(xnames) diff --git a/cmd/pdftext/writer.go b/cmd/pdftext/writer.go index e9717d9a..150c80e2 100644 --- a/cmd/pdftext/writer.go +++ b/cmd/pdftext/writer.go @@ -118,7 +118,7 @@ func (w *pdfWriter) Close() error { maxObj = ref[0] } } - for ref, _ := range w.objects { + for ref := range w.objects { if maxObj < ref[0] { maxObj = ref[0] } diff --git a/examples/html-canvas/main.go b/examples/html-canvas/main.go index 2bcf1404..c3d265ce 100644 --- a/examples/html-canvas/main.go +++ b/examples/html-canvas/main.go @@ -1,4 +1,4 @@ -// +build js +//go:build js package main diff --git a/examples/html-canvas/serve.go b/examples/html-canvas/serve.go index 13979e8e..4b03e753 100644 --- a/examples/html-canvas/serve.go +++ b/examples/html-canvas/serve.go @@ -1,4 +1,4 @@ -// +build !js +//go:build !js package main diff --git a/examples/opengl/main.go b/examples/opengl/main.go index 50bd4647..dba4a4bf 100644 --- a/examples/opengl/main.go +++ b/examples/opengl/main.go @@ -1,4 +1,4 @@ -// +build cgo +//go:build cgo package main diff --git a/font/sfnt_cff.go b/font/sfnt_cff.go index 0b8ba3a6..9076d429 100644 --- a/font/sfnt_cff.go +++ b/font/sfnt_cff.go @@ -237,7 +237,7 @@ func (cff *cffTable) ToPath(p Pather, glyphID, ppem uint16, x0, y0, f float64, h b1 := int32(r.ReadUint8()) v = (-(b0-251)*256 - b1 - 108) << 16 } else { - v = r.ReadInt32() // less-siginificant bits is fraction + v = r.ReadInt32() // least-significant bits are fraction } if cff.version == 1 && 48 <= len(stack) || cff.version == 2 && 513 <= len(stack) { return fmt.Errorf("%v: too many operands for operator", table) diff --git a/latex_bin.go b/latex_bin.go index 90ddb5eb..fef9abb2 100644 --- a/latex_bin.go +++ b/latex_bin.go @@ -1,4 +1,4 @@ -// +build latex +//go:build latex package canvas @@ -25,11 +25,12 @@ var tempDir = path.Join(os.TempDir(), "tdewolff-canvas") // ParseLaTeX parses a LaTeX formatted string into a path. It requires latex and dvisvgm to be installed on the machine. // The content is surrounded by: -// \documentclass{article} -// \begin{document} -// \thispagestyle{empty} -// {{input}} -// \end{document} +// +// \documentclass{article} +// \begin{document} +// \thispagestyle{empty} +// {{input}} +// \end{document} func ParseLaTeX(s string) (*Path, error) { if err := os.MkdirAll(tempDir, os.ModePerm); err != nil { panic(err) diff --git a/latex_bin_test.go b/latex_bin_test.go index d5035c50..ce4652f7 100644 --- a/latex_bin_test.go +++ b/latex_bin_test.go @@ -1,4 +1,4 @@ -// +build latex +//go:build latex package canvas diff --git a/renderers/htmlcanvas/htmlcanvas.go b/renderers/htmlcanvas/htmlcanvas.go index a5056053..78895fd3 100644 --- a/renderers/htmlcanvas/htmlcanvas.go +++ b/renderers/htmlcanvas/htmlcanvas.go @@ -1,4 +1,4 @@ -// +build js +//go:build js package htmlcanvas diff --git a/renderers/opengl/opengl.go b/renderers/opengl/opengl.go index 72ab4cc8..6b694035 100644 --- a/renderers/opengl/opengl.go +++ b/renderers/opengl/opengl.go @@ -1,4 +1,4 @@ -// +build cgo +//go:build cgo package opengl diff --git a/resources/preview/main.go b/resources/preview/main.go index 6a45acc8..eb58e581 100644 --- a/resources/preview/main.go +++ b/resources/preview/main.go @@ -1,5 +1,3 @@ -// +build harfbuzz - package main import ( diff --git a/text/fribidi.go b/text/fribidi.go index f9916af7..60885949 100644 --- a/text/fribidi.go +++ b/text/fribidi.go @@ -1,4 +1,4 @@ -// +build !fribidi js +//go:build !fribidi || js package text diff --git a/text/fribidi_cgo.go b/text/fribidi_cgo.go index ebe58030..d0bcf4db 100644 --- a/text/fribidi_cgo.go +++ b/text/fribidi_cgo.go @@ -1,4 +1,4 @@ -// +build fribidi,!js +//go:build fribidi && !js package text diff --git a/text/harfbuzz.go b/text/harfbuzz.go index a232789f..6dea8811 100644 --- a/text/harfbuzz.go +++ b/text/harfbuzz.go @@ -1,5 +1,4 @@ //go:build !harfbuzz || js -// +build !harfbuzz js package text diff --git a/text/harfbuzz_cgo.go b/text/harfbuzz_cgo.go index a0236528..fe07fa70 100644 --- a/text/harfbuzz_cgo.go +++ b/text/harfbuzz_cgo.go @@ -1,4 +1,4 @@ -// +build harfbuzz,!js +//go:build harfbuzz && !js package text