diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0b41702..d124019 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,11 +15,11 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: 1.19 + go-version-file: 'go.mod' - name: lint uses: golangci/golangci-lint-action@v4.0.0 with: - version: v1.50.1 + version: v1.56.1 tests-on-unix: needs: golangci-lint # run after golangci-lint action to not produce duplicated errors @@ -27,9 +27,8 @@ jobs: strategy: matrix: golang: - - "1.18" - - "1.19" - - "1.20" + - "stable" + - "oldstable" steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.golangci.yml b/.golangci.yml index 09e8f73..b26b1c1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,7 +60,7 @@ linters: disable-all: true enable: - bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false] - - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false] + - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false] - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false] - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false] @@ -99,6 +99,7 @@ linters: # - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false] # - cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false] # - deadcode # Finds unused code [fast: false, auto-fix: false] +# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false] # - dupl # Tool for code clone detection [fast: true, auto-fix: false] # - durationcheck # check for two durations multiplied together [fast: false, auto-fix: false] # - exhaustivestruct # Checks if all struct's fields are initialized [fast: false, auto-fix: false] diff --git a/Makefile b/Makefile index bc32db8..8f3cffc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html SOURCE_FILES?=./... -GOLANGCI_VERSION=v1.50.1 +GOLANGCI_VERSION=v1.56.1 COVERAGE=coverage.out export PATH := ./bin:$(PATH) diff --git a/cobra2snooty.go b/cobra2snooty.go index ec7603a..29ca1e7 100644 --- a/cobra2snooty.go +++ b/cobra2snooty.go @@ -107,7 +107,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error { if cmd.Runnable() { buf.WriteString(syntaxHeader) - buf.WriteString(fmt.Sprintf("\n %s\n\n", strings.ReplaceAll(cmd.UseLine(), "[flags]", "[options]"))) + _, _ = fmt.Fprintf(buf, "\n %s\n\n", strings.ReplaceAll(cmd.UseLine(), "[flags]", "[options]")) buf.WriteString(".. Code end marker, please don't delete this comment\n\n") } if err := printArgs(buf, cmd); err != nil { @@ -134,7 +134,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error { } cname := name + " " + child.Name() ref = strings.ReplaceAll(cname, " ", separator) - buf.WriteString(fmt.Sprintf("* :ref:`%s` - %s\n", ref, child.Short)) + _, _ = fmt.Fprintf(buf, "* :ref:`%s` - %s\n", ref, child.Short) } buf.WriteString("\n") } @@ -150,7 +150,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error { } cname := name + " " + child.Name() ref = strings.ReplaceAll(cname, " ", separator) - buf.WriteString(fmt.Sprintf(" %s \n", child.Name(), ref)) + _, _ = fmt.Fprintf(buf, " %s \n", child.Name(), ref) } buf.WriteString("\n") } diff --git a/examples.go b/examples.go index 2b986b6..dc2b169 100644 --- a/examples.go +++ b/examples.go @@ -43,6 +43,6 @@ func printExamples(buf *bytes.Buffer, cmd *cobra.Command) { } buf.WriteString(`.. code-block:: `) - buf.WriteString(fmt.Sprintf("\n %s%s\n", comment, indentString(example, identChar))) + _, _ = fmt.Fprintf(buf, "\n %s%s\n", comment, indentString(example, identChar)) } } diff --git a/go.mod b/go.mod index fff213f..8e4ae69 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/mongodb-labs/cobra2snooty -go 1.18 +go 1.20 require ( github.com/spf13/cobra v1.8.0