mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-23 15:25:03 +01:00
Fix all 93 lint-go errors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"gitea.com/gitea/act_runner/pkg/model"
|
||||
)
|
||||
|
||||
func drawGraph(plan *model.Plan) error {
|
||||
func drawGraph(plan *model.Plan) {
|
||||
drawings := make([]*common.Drawing, 0)
|
||||
|
||||
jobPen := common.NewPen(common.StyleSingleLine, 96)
|
||||
@@ -34,5 +34,4 @@ func drawGraph(plan *model.Plan) error {
|
||||
for _, d := range drawings {
|
||||
d.Draw(os.Stdout, maxWidth)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
10
cmd/list.go
10
cmd/list.go
@@ -2,13 +2,14 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gitea.com/gitea/act_runner/pkg/model"
|
||||
)
|
||||
|
||||
func printList(plan *model.Plan) error {
|
||||
func printList(plan *model.Plan) {
|
||||
type lineInfoDef struct {
|
||||
jobID string
|
||||
jobName string
|
||||
@@ -82,7 +83,7 @@ func printList(plan *model.Plan) error {
|
||||
wfNameMaxWidth += 2
|
||||
wfFileMaxWidth += 2
|
||||
|
||||
fmt.Printf("%*s%*s%*s%*s%*s%*s\n",
|
||||
fmt.Fprintf(os.Stdout, "%*s%*s%*s%*s%*s%*s\n",
|
||||
-stageMaxWidth, header.stage,
|
||||
-jobIDMaxWidth, header.jobID,
|
||||
-jobNameMaxWidth, header.jobName,
|
||||
@@ -91,7 +92,7 @@ func printList(plan *model.Plan) error {
|
||||
-eventsMaxWidth, header.events,
|
||||
)
|
||||
for _, line := range lineInfos {
|
||||
fmt.Printf("%*s%*s%*s%*s%*s%*s\n",
|
||||
fmt.Fprintf(os.Stdout, "%*s%*s%*s%*s%*s%*s\n",
|
||||
-stageMaxWidth, line.stage,
|
||||
-jobIDMaxWidth, line.jobID,
|
||||
-jobNameMaxWidth, line.jobName,
|
||||
@@ -101,7 +102,6 @@ func printList(plan *model.Plan) error {
|
||||
)
|
||||
}
|
||||
if duplicateJobIDs {
|
||||
fmt.Print("\nDetected multiple jobs with the same job name, use `-W` to specify the path to the specific workflow.\n")
|
||||
fmt.Fprint(os.Stdout, "\nDetected multiple jobs with the same job name, use `-W` to specify the path to the specific workflow.\n")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
24
cmd/root.go
24
cmd/root.go
@@ -237,7 +237,7 @@ func bugReport(ctx context.Context, version string) error {
|
||||
|
||||
info, err := container.GetHostInfo(ctx)
|
||||
if err != nil {
|
||||
fmt.Println(report)
|
||||
fmt.Fprintln(os.Stdout, report)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -265,11 +265,11 @@ func bugReport(ctx context.Context, version string) error {
|
||||
}
|
||||
report += reportSb252.String()
|
||||
|
||||
fmt.Println(report)
|
||||
fmt.Fprintln(os.Stdout, report)
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateManPage(cmd *cobra.Command) error {
|
||||
func generateManPage(cmd *cobra.Command) {
|
||||
header := &doc.GenManHeader{
|
||||
Title: "act",
|
||||
Section: "1",
|
||||
@@ -277,8 +277,7 @@ func generateManPage(cmd *cobra.Command) error {
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
cobra.CheckErr(doc.GenMan(cmd, header, buf))
|
||||
fmt.Print(buf.String())
|
||||
return nil
|
||||
fmt.Fprint(os.Stdout, buf.String())
|
||||
}
|
||||
|
||||
func listOptions(cmd *cobra.Command) error {
|
||||
@@ -287,7 +286,7 @@ func listOptions(cmd *cobra.Command) error {
|
||||
flags = append(flags, Flag{Name: f.Name, Default: f.DefValue, Description: f.Usage, Type: f.Value.Type()})
|
||||
})
|
||||
a, err := json.Marshal(flags)
|
||||
fmt.Println(string(a))
|
||||
fmt.Fprintln(os.Stdout, string(a))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -409,7 +408,8 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||
return bugReport(ctx, cmd.Version)
|
||||
}
|
||||
if ok, _ := cmd.Flags().GetBool("man-page"); ok {
|
||||
return generateManPage(cmd)
|
||||
generateManPage(cmd)
|
||||
return nil
|
||||
}
|
||||
if input.listOptions {
|
||||
return listOptions(cmd)
|
||||
@@ -540,18 +540,12 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||
}
|
||||
|
||||
if list {
|
||||
err = printList(filterPlan)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(filterPlan)
|
||||
return plannerErr
|
||||
}
|
||||
|
||||
if graph {
|
||||
err = drawGraph(filterPlan)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
drawGraph(filterPlan)
|
||||
return plannerErr
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ func newSecrets(secretList []string) secrets {
|
||||
} else if env, ok := os.LookupEnv(secretPairParts[0]); ok && env != "" {
|
||||
s[secretPairParts[0]] = env
|
||||
} else {
|
||||
fmt.Printf("Provide value for '%s': ", secretPairParts[0])
|
||||
fmt.Fprintf(os.Stdout, "Provide value for '%s': ", secretPairParts[0])
|
||||
val, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||
fmt.Println()
|
||||
fmt.Fprintln(os.Stdout)
|
||||
if err != nil {
|
||||
log.Errorf("failed to read input: %v", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user