lint: fix linting issues

This commit is contained in:
Romain Bertrand 2025-12-08 10:00:50 +01:00
parent 36891e06f4
commit 1d94431825
4 changed files with 12 additions and 14 deletions

View file

@ -124,13 +124,13 @@ func runIssueList(cmd *cobra.Command, args []string) error {
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NUMBER\tTITLE\tSTATE\n")
_, _ = fmt.Fprintf(w, "NUMBER\tTITLE\tSTATE\n")
for _, issue := range issues {
if issue.PullRequest == nil {
fmt.Fprintf(w, "#%d\t%s\t%s\n", issue.Index, issue.Title, issue.State)
_, _ = fmt.Fprintf(w, "#%d\t%s\t%s\n", issue.Index, issue.Title, issue.State)
}
}
w.Flush()
_ = w.Flush()
return nil
}

View file

@ -116,11 +116,11 @@ func runPRList(cmd *cobra.Command, args []string) error {
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NUMBER\tTITLE\tBRANCH\tSTATE\n")
_, _ = fmt.Fprintf(w, "NUMBER\tTITLE\tBRANCH\tSTATE\n")
for _, pr := range prs {
fmt.Fprintf(w, "#%d\t%s\t%s\t%s\n", pr.Index, pr.Title, pr.Head.Ref, pr.State)
_, _ = fmt.Fprintf(w, "#%d\t%s\t%s\t%s\n", pr.Index, pr.Title, pr.Head.Ref, pr.State)
}
w.Flush()
_ = w.Flush()
return nil
}

View file

@ -127,7 +127,7 @@ func runRepoList(cmd *cobra.Command, args []string) error {
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NAME\tVISIBILITY\tDESCRIPTION\n")
_, _ = fmt.Fprintf(w, "NAME\tVISIBILITY\tDESCRIPTION\n")
for _, repo := range repos {
visibility := "public"
if repo.Private {
@ -137,9 +137,9 @@ func runRepoList(cmd *cobra.Command, args []string) error {
if len(desc) > 50 {
desc = desc[:47] + "..."
}
fmt.Fprintf(w, "%s/%s\t%s\t%s\n", repo.Owner.UserName, repo.Name, visibility, desc)
_, _ = fmt.Fprintf(w, "%s/%s\t%s\t%s\n", repo.Owner.UserName, repo.Name, visibility, desc)
}
w.Flush()
_ = w.Flush()
return nil
}

View file

@ -27,7 +27,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.config/fgj/config.yaml)")
rootCmd.PersistentFlags().String("hostname", "", "Forgejo instance hostname")
viper.BindPFlag("hostname", rootCmd.PersistentFlags().Lookup("hostname"))
_ = viper.BindPFlag("hostname", rootCmd.PersistentFlags().Lookup("hostname"))
}
func initConfig() {
@ -41,7 +41,7 @@ func initConfig() {
}
configDir := home + "/.config/fgj"
os.MkdirAll(configDir, 0755)
_ = os.MkdirAll(configDir, 0755)
viper.AddConfigPath(configDir)
viper.SetConfigType("yaml")
@ -51,7 +51,5 @@ func initConfig() {
viper.AutomaticEnv()
viper.SetEnvPrefix("FGJ")
if err := viper.ReadInConfig(); err == nil {
// Config file found and successfully parsed
}
_ = viper.ReadInConfig()
}