Skip to content

Commit

Permalink
chore: address more linting issues (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Oct 24, 2024
1 parent a11818c commit 4fd7d53
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var configDeleteCmd = &cobra.Command{

if lagoonConfig.Lagoon == "" {
fmt.Println("Missing arguments: Lagoon name is not defined")
cmd.Help()
_ = cmd.Help()
os.Exit(1)
}
if yesNo(fmt.Sprintf("You are attempting to delete config for lagoon '%s', are you sure?", lagoonConfig.Lagoon)) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var rootCmd = &cobra.Command{
displayVersionInfo()
return
}
cmd.Help()
_ = cmd.Help()
os.Exit(1)
},
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ var sshEnvCmd = &cobra.Command{
HostKeyCallback: hkcb,
HostKeyAlgorithms: hkalgo,
}
defer closeSSHAgent()
defer func() {
err = closeSSHAgent()
if err != nil {
fmt.Fprintf(os.Stderr, "error closing ssh agent:%v\n", err)
}
}()
if sshCommand != "" {
err = lagoonssh.RunSSHCommand(sshConfig, sshService, sshContainer, sshCommand, config)
} else {
Expand Down
1 change: 0 additions & 1 deletion cmd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ var updateUserCmd = &cobra.Command{
return err
}
if firstName == "" && lastName == "" && emailAddress == "" {
cmd.Help()
output.RenderError("Missing arguments: Nothing to update, please provide a field to update", outputOptions)
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var webCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
if cmdProjectName == "" {
fmt.Println("Missing arguments: Project name is not defined")
cmd.Help()
_ = cmd.Help()
os.Exit(1)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/lagoon/ssh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func LogStream(config *ssh.ClientConfig, host, port string, argv []string) error
func InteractiveSSH(lagoon map[string]string, sshService string, sshContainer string, config *ssh.ClientConfig) error {
client, err := ssh.Dial("tcp", lagoon["hostname"]+":"+lagoon["port"], config)
if err != nil {
return fmt.Errorf("Failed to dial: " + err.Error() + "\nCheck that the project or environment you are trying to connect to exists")
return fmt.Errorf("failed to dial: %s\nCheck that the project or environment you are trying to connect to exists", err.Error())
}

// start the session
session, err := client.NewSession()
if err != nil {
return fmt.Errorf("Failed to create session: " + err.Error())
return fmt.Errorf("failed to create session: %s", err.Error())
}
defer session.Close()
session.Stdout = os.Stdout
Expand Down

0 comments on commit 4fd7d53

Please sign in to comment.