Skip to content

Commit

Permalink
cmd: fix return value checks and statements
Browse files Browse the repository at this point in the history
golint complained about some return values not being used/checked
accordingly. This patch correct these.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
  • Loading branch information
bmeneg committed Jun 11, 2021
1 parent 5ff5fdb commit 69ae19e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cmd/ci_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ func doTrace(ctx context.Context, w io.Writer, pid interface{}, pipelineID int,
}
fmt.Fprintf(w, "Showing logs for %s job #%d\n", job.Name, job.ID)
})

_, err = io.CopyN(ioutil.Discard, trace, offset)
if err != nil {
return err
}

lenT, err := io.Copy(w, trace)
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion cmd/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var labelCmd = &cobra.Command{
PersistentPreRun: LabPersistentPreRun,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
return
},
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/project_browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var projectBrowseCmd = &cobra.Command{
PersistentPreRun: LabPersistentPreRun,
Run: func(cmd *cobra.Command, args []string) {
rn, _, err := parseArgsRemoteAndID(args)
if err != nil {
log.Fatal(err)
}

p, err := lab.FindProject(rn)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/show_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func printDiscussions(discussions []*gitlab.Discussion, since string, idstr stri
}
}

if sinceIsSet == false {
if !sinceIsSet {
config.WriteConfigEntry(CommandPrefix+issueEntry, newAccessTime, "", "")
}
}
7 changes: 7 additions & 0 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func getBranchMR(rn, branch string) int {
var num int = 0

mrBranch, err := git.UpstreamBranch(branch)
if err != nil {
log.Fatal(err)
}
if mrBranch == "" {
// Fall back to local branch
mrBranch = branch
Expand Down Expand Up @@ -316,6 +319,10 @@ func parseArgsWithGitBranchMR(args []string) (string, int64, error) {
err error
)
s, i, err := parseArgsRemoteAndID(args)
if err != nil {
return "", 0, err
}

if i == 0 {
s, branch, err = parseArgsRemoteAndString(args)
if err != nil {
Expand Down

0 comments on commit 69ae19e

Please sign in to comment.