Skip to content

Commit 8b1eba4

Browse files
authored
Fix linter errors (#2052)
When using golangci-lint v1.55.0 some new errors were being reported. Signed-off-by: Marc Khouzam <[email protected]>
1 parent 4cafa37 commit 8b1eba4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

command.go

+1
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,7 @@ func (c *Command) UseLine() string {
14461446

14471447
// DebugFlags used to determine which flags have been assigned to which commands
14481448
// and which persist.
1449+
// nolint:goconst
14491450
func (c *Command) DebugFlags() {
14501451
c.Println("DebugFlags called on", c.Name())
14511452
var debugflags func(*Command)

doc/md_docs.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import (
2727
"github.com/spf13/cobra"
2828
)
2929

30+
const markdownExtension = ".md"
31+
3032
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
3133
flags := cmd.NonInheritedFlags()
3234
flags.SetOutput(buf)
@@ -83,7 +85,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
8385
if cmd.HasParent() {
8486
parent := cmd.Parent()
8587
pname := parent.CommandPath()
86-
link := pname + ".md"
88+
link := pname + markdownExtension
8789
link = strings.ReplaceAll(link, " ", "_")
8890
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
8991
cmd.VisitParents(func(c *cobra.Command) {
@@ -101,7 +103,7 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
101103
continue
102104
}
103105
cname := name + " " + child.Name()
104-
link := cname + ".md"
106+
link := cname + markdownExtension
105107
link = strings.ReplaceAll(link, " ", "_")
106108
buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
107109
}
@@ -138,7 +140,7 @@ func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHa
138140
}
139141
}
140142

141-
basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + ".md"
143+
basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + markdownExtension
142144
filename := filepath.Join(dir, basename)
143145
f, err := os.Create(filename)
144146
if err != nil {

0 commit comments

Comments
 (0)