Merge pull request #6291 from seanlaii/fix-QF1004

Fix lint issue QF1004
This commit is contained in:
karmada-bot 2025-04-12 16:32:59 +08:00 committed by GitHub
commit a05c7dc006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 5 deletions

View File

@ -71,7 +71,6 @@ linters:
# Issue: https://github.com/karmada-io/karmada/issues/6273.
- "-QF1008"
- "-ST1005"
- "-QF1004"
- "-ST1011"
- "-QF1003"
- "-QF1001"

View File

@ -35,7 +35,7 @@ func MarkdownPostProcessing(cmd *cobra.Command, dir string, processor func(strin
}
}
basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md"
basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + ".md"
filename := filepath.Join(dir, basename)
// Remove the markdown file for the version subcommand

View File

@ -46,7 +46,7 @@ func PrintCLIByTag(cmd *cobra.Command, all []*cobra.Command, tag string) string
}
cname := cmd.Name() + " " + c.Name()
link := cname
link = strings.Replace(link, " ", "_", -1) + ".md"
link = strings.ReplaceAll(link, " ", "_") + ".md"
pl = append(pl, fmt.Sprintf("* [%s](%s)\t - %s\n", cname, link, c.Long))
}
@ -59,7 +59,7 @@ func PrintCLIByTag(cmd *cobra.Command, all []*cobra.Command, tag string) string
// GenMarkdownTreeForIndex generate the index page for karmadactl
func GenMarkdownTreeForIndex(cmd *cobra.Command, dir string) error {
basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + "_index" + ".md"
basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + "_index" + ".md"
filename := filepath.Join(dir, basename)
f, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR, pkgutil.DefaultFilePerm)
if err != nil {

View File

@ -138,7 +138,7 @@ func GenerateRegisterCommand(kubeConfig, parentCommand, token string, karmadaCon
}
return fmt.Sprintf("%s register %s --token %s --discovery-token-ca-cert-hash %s",
parentCommand, strings.Replace(clusterConfig.Server, "https://", "", -1),
parentCommand, strings.ReplaceAll(clusterConfig.Server, "https://", ""),
token, strings.Join(publicKeyPins, ",")), nil
}