From 8a20dd119ad94c5fc6076b2e1e45a35f95e0e9ac Mon Sep 17 00:00:00 2001 From: Kartikay Date: Tue, 28 Jan 2025 20:12:28 +0530 Subject: [PATCH] gofumpt Signed-off-by: Kartikay --- magefiles/magefile.go | 3 ++- magefiles/util.go | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/magefiles/magefile.go b/magefiles/magefile.go index e974333..5b5c959 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -4,10 +4,11 @@ package main import ( + "os" + "github.com/authzed/zed/internal/cmd" "github.com/jzelinskie/cobrautil/v2/cobrazerolog" "github.com/magefile/mage/mg" - "os" ) type Gen mg.Namespace diff --git a/magefiles/util.go b/magefiles/util.go index 528f28f..4ab19ec 100644 --- a/magefiles/util.go +++ b/magefiles/util.go @@ -1,3 +1,6 @@ +//go:build mage +// +build mage + package main import ( @@ -23,7 +26,6 @@ func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() } func GenCustomMarkdownTree(cmd *cobra.Command, dir string) error { - basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + ".md" filename := filepath.Join(dir, basename) @@ -34,7 +36,6 @@ func GenCustomMarkdownTree(cmd *cobra.Command, dir string) error { defer f.Close() return genMarkdownTreeCustom(cmd, f) - } func genMarkdownTreeCustom(cmd *cobra.Command, f *os.File) error { @@ -132,7 +133,6 @@ func hasSeeAlso(cmd *cobra.Command) bool { } func printOptions(buf *bytes.Buffer, cmd *cobra.Command) error { - flags := cmd.NonInheritedFlags() flags.SetOutput(buf) @@ -145,12 +145,11 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command) error { parentFlags := cmd.InheritedFlags() parentFlags.SetOutput(buf) - if flags.HasAvailableFlags() { + if parentFlags.HasAvailableFlags() { buf.WriteString("### Options Inherited From Parent Flags\n\n```\n") - flags.PrintDefaults() + parentFlags.PrintDefaults() buf.WriteString("```\n\n") } return nil - }