lint: fix linting issues
This commit is contained in:
parent
36891e06f4
commit
1d94431825
4 changed files with 12 additions and 14 deletions
|
|
@ -124,13 +124,13 @@ func runIssueList(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
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 {
|
for _, issue := range issues {
|
||||||
if issue.PullRequest == nil {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,11 @@ func runPRList(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
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 {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ func runRepoList(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
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 {
|
for _, repo := range repos {
|
||||||
visibility := "public"
|
visibility := "public"
|
||||||
if repo.Private {
|
if repo.Private {
|
||||||
|
|
@ -137,9 +137,9 @@ func runRepoList(cmd *cobra.Command, args []string) error {
|
||||||
if len(desc) > 50 {
|
if len(desc) > 50 {
|
||||||
desc = desc[:47] + "..."
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ func init() {
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.config/fgj/config.yaml)")
|
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.config/fgj/config.yaml)")
|
||||||
rootCmd.PersistentFlags().String("hostname", "", "Forgejo instance hostname")
|
rootCmd.PersistentFlags().String("hostname", "", "Forgejo instance hostname")
|
||||||
viper.BindPFlag("hostname", rootCmd.PersistentFlags().Lookup("hostname"))
|
_ = viper.BindPFlag("hostname", rootCmd.PersistentFlags().Lookup("hostname"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
|
|
@ -41,7 +41,7 @@ func initConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
configDir := home + "/.config/fgj"
|
configDir := home + "/.config/fgj"
|
||||||
os.MkdirAll(configDir, 0755)
|
_ = os.MkdirAll(configDir, 0755)
|
||||||
|
|
||||||
viper.AddConfigPath(configDir)
|
viper.AddConfigPath(configDir)
|
||||||
viper.SetConfigType("yaml")
|
viper.SetConfigType("yaml")
|
||||||
|
|
@ -51,7 +51,5 @@ func initConfig() {
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
viper.SetEnvPrefix("FGJ")
|
viper.SetEnvPrefix("FGJ")
|
||||||
|
|
||||||
if err := viper.ReadInConfig(); err == nil {
|
_ = viper.ReadInConfig()
|
||||||
// Config file found and successfully parsed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue