Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: update go compatibility #49

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@ 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@v3.7.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
runs-on: ubuntu-latest
strategy:
matrix:
golang:
- "1.18"
- "1.19"
- "1.20"
- "stable"
- "oldstable"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cobra2snooty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
}
Expand All @@ -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 </command/%s>\n", child.Name(), ref))
_, _ = fmt.Fprintf(buf, " %s </command/%s>\n", child.Name(), ref)
}
buf.WriteString("\n")
}
Expand Down
2 changes: 1 addition & 1 deletion examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mongodb-labs/cobra2snooty

go 1.18
go 1.20

require (
github.com/spf13/cobra v1.8.0
Expand Down
Loading