Skip to content
Merged
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
2 changes: 1 addition & 1 deletion cmd/api/v1/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func newMethodsCmd(c *config.Config) *cobra.Command {
sort.Strings(methods)

for _, method := range methods {
fmt.Fprintln(c.Out, method)
_, _ = fmt.Fprintln(c.Out, method)
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions cmd/api/v1/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (c *project) join(args []string) error {
return fmt.Errorf("failed to join project: %w", err)
}

fmt.Fprintf(c.c.Out, "%s successfully joined project \"%s\"\n", color.GreenString("✔"), color.GreenString(acceptResp.Msg.ProjectName))
_, _ = fmt.Fprintf(c.c.Out, "%s successfully joined project \"%s\"\n", color.GreenString("✔"), color.GreenString(acceptResp.Msg.ProjectName))

return nil
}
Expand All @@ -347,8 +347,8 @@ func (c *project) generateInvite() error {
return fmt.Errorf("failed to generate an invite: %w", err)
}

fmt.Fprintf(c.c.Out, "You can share this secret with the member to join, it expires in %s:\n\n", humanize.Time(resp.Msg.Invite.ExpiresAt.AsTime()))
fmt.Fprintf(c.c.Out, "%s (https://console.metal-stack.io/project-invite/%s)\n", resp.Msg.Invite.Secret, resp.Msg.Invite.Secret)
_, _ = fmt.Fprintf(c.c.Out, "You can share this secret with the member to join, it expires in %s:\n\n", humanize.Time(resp.Msg.Invite.ExpiresAt.AsTime()))
_, _ = fmt.Fprintf(c.c.Out, "%s (https://console.metal-stack.io/project-invite/%s)\n", resp.Msg.Invite.Secret, resp.Msg.Invite.Secret)

return nil
}
Expand Down Expand Up @@ -409,7 +409,7 @@ func (c *project) removeMember(args []string) error {
return fmt.Errorf("failed to remove member from project: %w", err)
}

fmt.Fprintf(c.c.Out, "%s successfully removed member %q\n", color.GreenString("✔"), member)
_, _ = fmt.Fprintf(c.c.Out, "%s successfully removed member %q\n", color.GreenString("✔"), member)

return nil
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/api/v1/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (c *tenant) join(args []string) error {
return fmt.Errorf("failed to join tenant: %w", err)
}

fmt.Fprintf(c.c.Out, "%s successfully joined tenant \"%s\"\n", color.GreenString("✔"), color.GreenString(acceptResp.Msg.TenantName))
_, _ = fmt.Fprintf(c.c.Out, "%s successfully joined tenant \"%s\"\n", color.GreenString("✔"), color.GreenString(acceptResp.Msg.TenantName))

return nil
}
Expand All @@ -328,8 +328,8 @@ func (c *tenant) generateInvite() error {
return fmt.Errorf("failed to generate an invite: %w", err)
}

fmt.Fprintf(c.c.Out, "You can share this secret with the member to join, it expires in %s:\n\n", humanize.Time(resp.Msg.Invite.ExpiresAt.AsTime()))
fmt.Fprintf(c.c.Out, "%s (https://console.metal-stack.io/organization-invite/%s)\n", resp.Msg.Invite.Secret, resp.Msg.Invite.Secret)
_, _ = fmt.Fprintf(c.c.Out, "You can share this secret with the member to join, it expires in %s:\n\n", humanize.Time(resp.Msg.Invite.ExpiresAt.AsTime()))
_, _ = fmt.Fprintf(c.c.Out, "%s (https://console.metal-stack.io/organization-invite/%s)\n", resp.Msg.Invite.Secret, resp.Msg.Invite.Secret)

return nil
}
Expand Down Expand Up @@ -405,7 +405,7 @@ func (c *tenant) removeMember(args []string) error {
return fmt.Errorf("failed to remove member from tenant: %w", err)
}

fmt.Fprintf(c.c.Out, "%s successfully removed member %q\n", color.GreenString("✔"), member)
_, _ = fmt.Fprintf(c.c.Out, "%s successfully removed member %q\n", color.GreenString("✔"), member)

return nil
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/api/v1/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ func (c *token) Create(rq *apiv2.TokenServiceCreateRequest) (*apiv2.Token, error
return nil, err
}

fmt.Fprintf(c.c.Out, "Make sure to copy your personal access token now as you will not be able to see this again.\n")
fmt.Fprintln(c.c.Out)
fmt.Fprintln(c.c.Out, resp.Msg.GetSecret())
fmt.Fprintln(c.c.Out)
_, _ = fmt.Fprintf(c.c.Out, "Make sure to copy your personal access token now as you will not be able to see this again.\n")
_, _ = fmt.Fprintln(c.c.Out)
_, _ = fmt.Fprintln(c.c.Out, resp.Msg.GetSecret())
_, _ = fmt.Fprintln(c.c.Out)

// TODO: allow printer in metal-lib to be silenced

Expand Down
14 changes: 7 additions & 7 deletions cmd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (c *ctx) short() error {
return err
}

fmt.Fprint(c.c.Out, ctxs.CurrentContext)
_, _ = fmt.Fprint(c.c.Out, ctxs.CurrentContext)

return nil
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func (c *ctx) add(args []string) error {
return err
}

fmt.Fprintf(c.c.Out, "%s added context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))
_, _ = fmt.Fprintf(c.c.Out, "%s added context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))

return nil
}
Expand Down Expand Up @@ -228,7 +228,7 @@ func (c *ctx) update(args []string) error {
return err
}

fmt.Fprintf(c.c.Out, "%s updated context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))
_, _ = fmt.Fprintf(c.c.Out, "%s updated context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))

return nil
}
Expand Down Expand Up @@ -256,7 +256,7 @@ func (c *ctx) remove(args []string) error {
return err
}

fmt.Fprintf(c.c.Out, "%s removed context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))
_, _ = fmt.Fprintf(c.c.Out, "%s removed context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))

return nil
}
Expand Down Expand Up @@ -288,7 +288,7 @@ func (c *ctx) set(args []string) error {
return fmt.Errorf("context %s not found", nextCtx)
}
if nextCtx == ctxs.CurrentContext {
fmt.Fprintf(c.c.Out, "%s context \"%s\" already active\n", color.GreenString("✔"), color.GreenString(ctxs.CurrentContext))
_, _ = fmt.Fprintf(c.c.Out, "%s context \"%s\" already active\n", color.GreenString("✔"), color.GreenString(ctxs.CurrentContext))
return nil
}
ctxs.PreviousContext = ctxs.CurrentContext
Expand All @@ -300,7 +300,7 @@ func (c *ctx) set(args []string) error {
return err
}

fmt.Fprintf(c.c.Out, "%s switched context to \"%s\"\n", color.GreenString("✔"), color.GreenString(ctxs.CurrentContext))
_, _ = fmt.Fprintf(c.c.Out, "%s switched context to \"%s\"\n", color.GreenString("✔"), color.GreenString(ctxs.CurrentContext))

return nil
}
Expand Down Expand Up @@ -328,7 +328,7 @@ func (c *ctx) setProject(args []string) error {
return err
}

fmt.Fprintf(c.c.Out, "%s switched context default project to \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.DefaultProject))
_, _ = fmt.Fprintf(c.c.Out, "%s switched context default project to \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.DefaultProject))

return nil
}
2 changes: 1 addition & 1 deletion cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (l *login) login() error {
return err
}

fmt.Fprintf(l.c.Out, "%s login successful! Updated and activated context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))
_, _ = fmt.Fprintf(l.c.Out, "%s login successful! Updated and activated context \"%s\"\n", color.GreenString("✔"), color.GreenString(ctx.Name))

return nil
}
2 changes: 1 addition & 1 deletion cmd/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (l *logout) logout() error {
}
_ = listener.Close()

fmt.Fprintf(l.c.Out, "%s logout successful! \n", color.GreenString("✔"))
_, _ = fmt.Fprintf(l.c.Out, "%s logout successful! \n", color.GreenString("✔"))

return nil
}