diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7519770..ef99450 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,7 @@ jobs: name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.23" - name: Download modules run: | diff --git a/.golangci.yml b/.golangci.yml index 6c65571..56a199f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,7 +3,6 @@ run: linters: enable: - - deadcode - depguard - gofmt - goimports @@ -13,7 +12,6 @@ linters: - ineffassign - misspell - typecheck - - varcheck - errname - makezero - whitespace @@ -21,12 +19,11 @@ linters: linters-settings: depguard: - list-type: blacklist - include-go-root: true - packages: - # The io/ioutil package has been deprecated. - # https://go.dev/doc/go1.16#ioutil - - io/ioutil + rules: + main: + deny: + - pkg: io/ioutil + desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil importas: no-unaliased: true diff --git a/Dockerfile b/Dockerfile index f0e2739..a17000f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG GO_VERSION="1.18" -ARG GOLANGCI_LINT_VERSION="v1.45" +ARG GO_VERSION="1.23" +ARG GOLANGCI_LINT_VERSION="v1.62" ARG ADDLICENSE_VERSION="v1.0.0" ARG LICENSE_ARGS="-c cli-docs-tool -l apache" diff --git a/clidocstool_man_test.go b/clidocstool_man_test.go index f30e80c..f847250 100644 --- a/clidocstool_man_test.go +++ b/clidocstool_man_test.go @@ -57,7 +57,7 @@ func TestGenManTree(t *testing.T) { seen := make(map[string]struct{}) remanpage := regexp.MustCompile(`\.\d+$`) - filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs and any file that is not a manpage if info.IsDir() || !remanpage.MatchString(fname) { @@ -77,7 +77,7 @@ func TestGenManTree(t *testing.T) { return nil }) - filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs and any file that is not a manpage if info.IsDir() || !remanpage.MatchString(fname) { diff --git a/clidocstool_md_test.go b/clidocstool_md_test.go index 4683854..2abf72c 100644 --- a/clidocstool_md_test.go +++ b/clidocstool_md_test.go @@ -42,7 +42,7 @@ func TestGenMarkdownTree(t *testing.T) { seen := make(map[string]struct{}) - filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs, .pre.md files and any file that is not a .md file if info.IsDir() || !strings.HasSuffix(fname, ".md") || strings.HasSuffix(fname, ".pre.md") { @@ -62,7 +62,7 @@ func TestGenMarkdownTree(t *testing.T) { return nil }) - filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs, .pre.md files and any file that is not a .md file if info.IsDir() || !strings.HasSuffix(fname, ".md") || strings.HasSuffix(fname, ".pre.md") { diff --git a/clidocstool_test.go b/clidocstool_test.go index 7b3e1d6..0d3a488 100644 --- a/clidocstool_test.go +++ b/clidocstool_test.go @@ -49,7 +49,7 @@ func setup() { SilenceUsage: true, SilenceErrors: true, TraverseChildren: true, - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, Version: "20.10.8", DisableFlagsInUseLine: true, } @@ -65,7 +65,7 @@ func setup() { Annotations: map[string]string{ "aliases": "docker container attach, docker attach", }, - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, } attachFlags := attachCmd.Flags() @@ -86,7 +86,7 @@ func setup() { Use: "build [OPTIONS] PATH | URL | -", Aliases: []string{"b"}, Short: "Start a build", - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, Annotations: map[string]string{ "aliases": "docker image build, docker buildx build, docker buildx b, docker build", }, @@ -95,19 +95,19 @@ func setup() { Use: "dial-stdio", Short: "Proxy current stdio streams to builder instance", Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, } buildxInstallCmd = &cobra.Command{ Use: "install", Short: "Install buildx as a 'docker builder' alias", Args: cobra.ExactArgs(0), - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, Hidden: true, } buildxStopCmd = &cobra.Command{ Use: "stop [NAME]", Short: "Stop builder instance", - Run: func(cmd *cobra.Command, args []string) {}, + Run: func(*cobra.Command, []string) {}, } buildxPFlags := buildxCmd.PersistentFlags() @@ -255,7 +255,7 @@ func TestGenAllTree(t *testing.T) { seen := make(map[string]struct{}) - filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { fname := filepath.Base(path) // ignore dirs and .pre.md files if info.IsDir() || strings.HasSuffix(fname, ".pre.md") { @@ -275,7 +275,7 @@ func TestGenAllTree(t *testing.T) { return nil }) - filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs and .pre.md files if info.IsDir() || strings.HasSuffix(fname, ".pre.md") { diff --git a/clidocstool_yaml.go b/clidocstool_yaml.go index acf5f2b..2add1e6 100644 --- a/clidocstool_yaml.go +++ b/clidocstool_yaml.go @@ -77,7 +77,7 @@ type cmdDoc struct { // subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` // it is undefined which help output will be in the file `cmd-sub-third.1`. func (c *Client) GenYamlTree(cmd *cobra.Command) error { - emptyStr := func(s string) string { return "" } + emptyStr := func(string) string { return "" } if err := c.loadLongDescription(cmd, "yaml"); err != nil { return err } diff --git a/clidocstool_yaml_test.go b/clidocstool_yaml_test.go index 05fd104..e412fb0 100644 --- a/clidocstool_yaml_test.go +++ b/clidocstool_yaml_test.go @@ -40,7 +40,7 @@ func TestGenYamlTree(t *testing.T) { seen := make(map[string]struct{}) - filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs and any file that is not a .yaml file if info.IsDir() || !strings.HasSuffix(fname, ".yaml") { @@ -60,7 +60,7 @@ func TestGenYamlTree(t *testing.T) { return nil }) - filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { + _ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error { fname := filepath.Base(path) // ignore dirs and any file that is not a .yaml file if info.IsDir() || !strings.HasSuffix(fname, ".yaml") {