From fce3b49704ef92393301ba1499b2b8b97dcacf87 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Mon, 6 May 2024 21:49:40 +0000 Subject: [PATCH] Fixing linter issues --- .golangci.toml | 16 ++++++++++++++++ cmd/gobl.html/main.go | 1 + cmd/gobl.html/serve.go | 2 +- components/bill/invoice/invoice.go | 2 ++ components/org/org.go | 3 +++ goblhtml.go | 1 + internal/options.go | 1 + pkg/pdf/gotenberg.go | 2 +- pkg/pdf/prince.go | 2 +- pkg/pdf/weasyprint.go | 2 +- 10 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .golangci.toml create mode 100644 components/bill/invoice/invoice.go create mode 100644 components/org/org.go diff --git a/.golangci.toml b/.golangci.toml new file mode 100644 index 0000000..61b2b79 --- /dev/null +++ b/.golangci.toml @@ -0,0 +1,16 @@ +[run] +timeout = "120s" + +[output] +format = "colored-line-number" + +[linters] +enable = [ + "gocyclo", "unconvert", "goimports", "unused", "unused", + "vetshadow", "nakedret", "errcheck", "revive", "ineffassign", + "goconst", "vet", "unparam", "gofmt" +] + +[issues] +exclude-use-default = false + diff --git a/cmd/gobl.html/main.go b/cmd/gobl.html/main.go index 2287ec8..bcc1b2b 100644 --- a/cmd/gobl.html/main.go +++ b/cmd/gobl.html/main.go @@ -1,3 +1,4 @@ +// Package main provides the entry point for the gobl.html command-line tool. package main import ( diff --git a/cmd/gobl.html/serve.go b/cmd/gobl.html/serve.go index 9262c03..c18eda6 100644 --- a/cmd/gobl.html/serve.go +++ b/cmd/gobl.html/serve.go @@ -48,7 +48,7 @@ func (s *serveOpts) cmd() *cobra.Command { return cmd } -func (s *serveOpts) runE(cmd *cobra.Command, args []string) error { +func (s *serveOpts) runE(cmd *cobra.Command, _ []string) error { ctx, cancel := context.WithCancel(cmd.Context()) defer cancel() diff --git a/components/bill/invoice/invoice.go b/components/bill/invoice/invoice.go new file mode 100644 index 0000000..815eea6 --- /dev/null +++ b/components/bill/invoice/invoice.go @@ -0,0 +1,2 @@ +// Package invoice provides a template for rendering a complete GOBL bill.Invoice object. +package invoice diff --git a/components/org/org.go b/components/org/org.go new file mode 100644 index 0000000..bb1dc5c --- /dev/null +++ b/components/org/org.go @@ -0,0 +1,3 @@ +// Package org helps render organization information from the +// GOBL `org` package. +package org diff --git a/goblhtml.go b/goblhtml.go index e9976bb..b9b87dc 100644 --- a/goblhtml.go +++ b/goblhtml.go @@ -1,3 +1,4 @@ +// Package goblhtml provides a simple way to render HTML documents from GOBL envelopes. package goblhtml import ( diff --git a/internal/options.go b/internal/options.go index 1b54ecc..6fbc382 100644 --- a/internal/options.go +++ b/internal/options.go @@ -1,3 +1,4 @@ +// Package internal is used for internal option configuration. package internal import ( diff --git a/pkg/pdf/gotenberg.go b/pkg/pdf/gotenberg.go index 4537b1c..8a452d6 100644 --- a/pkg/pdf/gotenberg.go +++ b/pkg/pdf/gotenberg.go @@ -34,7 +34,7 @@ func newGotenbergConvertor(opts ...Config) (*gotenbergConvertor, error) { return gc, nil } -func (gc *gotenbergConvertor) HTML(ctx context.Context, data []byte, opts ...Option) ([]byte, error) { +func (gc *gotenbergConvertor) HTML(_ context.Context, data []byte, _ ...Option) ([]byte, error) { buf := bytes.NewBuffer(data) resp, err := gc.client.R(). SetFileReader("files", "index.html", buf). diff --git a/pkg/pdf/prince.go b/pkg/pdf/prince.go index 9985bf3..27adba9 100644 --- a/pkg/pdf/prince.go +++ b/pkg/pdf/prince.go @@ -22,7 +22,7 @@ func newPrinceConvertor() (*princeConvertor, error) { return c, nil } -func (pc *princeConvertor) HTML(ctx context.Context, data []byte, opts ...Option) ([]byte, error) { +func (pc *princeConvertor) HTML(_ context.Context, data []byte, opts ...Option) ([]byte, error) { o := prepareOptions(opts) j := new(princepdf.Job) j.Input = &princepdf.Input{ diff --git a/pkg/pdf/weasyprint.go b/pkg/pdf/weasyprint.go index 169831a..69021a4 100644 --- a/pkg/pdf/weasyprint.go +++ b/pkg/pdf/weasyprint.go @@ -33,7 +33,7 @@ func newWeasyprintConvertor(opts ...Config) (*weasyprintConvertor, error) { return gc, nil } -func (gc *weasyprintConvertor) HTML(ctx context.Context, data []byte, opts ...Option) ([]byte, error) { +func (gc *weasyprintConvertor) HTML(_ context.Context, data []byte, _ ...Option) ([]byte, error) { buf := bytes.NewBuffer(data) resp, err := gc.client.R(). SetFileReader("html", "index.html", buf).