Skip to content

Commit f55c021

Browse files
authored
task: update go compatibility (#49)
1 parent 79f3e76 commit f55c021

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@ jobs:
1515
- name: Install Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: 1.19
18+
go-version-file: 'go.mod'
1919
- name: lint
2020
uses: golangci/[email protected]
2121
with:
22-
version: v1.50.1
22+
version: v1.56.1
2323

2424
tests-on-unix:
2525
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
2929
golang:
30-
- "1.18"
31-
- "1.19"
32-
- "1.20"
30+
- "stable"
31+
- "oldstable"
3332
steps:
3433
- name: Checkout repository
3534
uses: actions/checkout@v4

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ linters:
6060
disable-all: true
6161
enable:
6262
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
63-
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false]
63+
6464
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
6565
- 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]
6666
- 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:
9999
# - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
100100
# - cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
101101
# - deadcode # Finds unused code [fast: false, auto-fix: false]
102+
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false]
102103
# - dupl # Tool for code clone detection [fast: true, auto-fix: false]
103104
# - durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
104105
# - exhaustivestruct # Checks if all struct's fields are initialized [fast: false, auto-fix: false]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
22

33
SOURCE_FILES?=./...
4-
GOLANGCI_VERSION=v1.50.1
4+
GOLANGCI_VERSION=v1.56.1
55
COVERAGE=coverage.out
66

77
export PATH := ./bin:$(PATH)

cobra2snooty.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error {
107107

108108
if cmd.Runnable() {
109109
buf.WriteString(syntaxHeader)
110-
buf.WriteString(fmt.Sprintf("\n %s\n\n", strings.ReplaceAll(cmd.UseLine(), "[flags]", "[options]")))
110+
_, _ = fmt.Fprintf(buf, "\n %s\n\n", strings.ReplaceAll(cmd.UseLine(), "[flags]", "[options]"))
111111
buf.WriteString(".. Code end marker, please don't delete this comment\n\n")
112112
}
113113
if err := printArgs(buf, cmd); err != nil {
@@ -134,7 +134,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error {
134134
}
135135
cname := name + " " + child.Name()
136136
ref = strings.ReplaceAll(cname, " ", separator)
137-
buf.WriteString(fmt.Sprintf("* :ref:`%s` - %s\n", ref, child.Short))
137+
_, _ = fmt.Fprintf(buf, "* :ref:`%s` - %s\n", ref, child.Short)
138138
}
139139
buf.WriteString("\n")
140140
}
@@ -150,7 +150,7 @@ func GenDocs(cmd *cobra.Command, w io.Writer) error {
150150
}
151151
cname := name + " " + child.Name()
152152
ref = strings.ReplaceAll(cname, " ", separator)
153-
buf.WriteString(fmt.Sprintf(" %s </command/%s>\n", child.Name(), ref))
153+
_, _ = fmt.Fprintf(buf, " %s </command/%s>\n", child.Name(), ref)
154154
}
155155
buf.WriteString("\n")
156156
}

examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ func printExamples(buf *bytes.Buffer, cmd *cobra.Command) {
4343
}
4444
buf.WriteString(`.. code-block::
4545
`)
46-
buf.WriteString(fmt.Sprintf("\n %s%s\n", comment, indentString(example, identChar)))
46+
_, _ = fmt.Fprintf(buf, "\n %s%s\n", comment, indentString(example, identChar))
4747
}
4848
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/mongodb-labs/cobra2snooty
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/spf13/cobra v1.8.0

0 commit comments

Comments
 (0)