From 0094cf451aa73ac269677eeec018b4539b6ddc7f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 13 Dec 2024 14:56:42 +0100 Subject: [PATCH] fix linting issues (revive) clidocstool_yaml_test.go:63:60: unused-parameter: parameter 'err' seems to be unused, consider removing or renaming it as _ (revive) filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { ^ clidocstool_man_test.go:80:60: unused-parameter: parameter 'err' seems to be unused, consider removing or renaming it as _ (revive) filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { ^ clidocstool_test.go:52:31: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive) Run: func(cmd *cobra.Command, args []string) {}, ^ clidocstool_md_test.go:65:60: unused-parameter: parameter 'err' seems to be unused, consider removing or renaming it as _ (revive) filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error { ^ clidocstool_test.go:68:13: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive) Run: func(cmd *cobra.Command, args []string) {}, ^ clidocstool_test.go:89:17: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive) Run: func(cmd *cobra.Command, args []string) {}, ^ clidocstool_yaml.go:80:19: unused-parameter: parameter 's' seems to be unused, consider removing or renaming it as _ (revive) emptyStr := func(s string) string { return "" } ^ Signed-off-by: Sebastiaan van Stijn --- clidocstool_man_test.go | 4 ++-- clidocstool_md_test.go | 4 ++-- clidocstool_test.go | 16 ++++++++-------- clidocstool_yaml.go | 2 +- clidocstool_yaml_test.go | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) 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") {