Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ type App struct{}

func (a App) Command() *cobra.Command {
cmd := &cobra.Command{
Use: metadata.Name,
Short: metadata.Description,
Version: metadata.Version,
Use: metadata.Name,
Short: metadata.Description,
Version: metadata.Version,
SilenceUsage: true,
}
cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
Expand Down
4 changes: 2 additions & 2 deletions pkg/sync/create_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func (c createPR) open() error {
}
cl := github.NewClient(args...)
cl.ProjectDir = c.Project.Path
buff, err := cl.Execute(c.Context)
defer c.Println("Github client:", buff)
_, err = cl.Execute(c.Context)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing the Print entirely?

I can agree to remove it if err == nil. Otherwise, the GitHub Client output might contain important debugging info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually for me the output was just an array of ints (that can be decoded to some URLs). It was not even useful in the error case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we can keep it for the error case, sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. It's a []byte not string.

It should be decoded before printing. Similarly, like here:

if err != nil {
return nil, errors.Wrap(err, ErrSyncFailed)
}
un := make([]map[string]interface{}, 0)
err = json.Unmarshal(buff, &un)
if err != nil {
return nil, errors.Wrap(err, ErrSyncFailed)
}
if len(un) > 0 {
u := fmt.Sprintf("%s", un[0]["url"])
return &u, nil
}


return errors.Wrap(err, ErrSyncFailed)
}

Expand Down
Loading