Skip to content

Commit

Permalink
Fixing lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
knabben committed Jan 17, 2024
1 parent c30953f commit 6b626f5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion experiments/swdt/cmd/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func RunKubernetes(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer runner.CloseConnection() //nolint
defer runner.CloseConnection() // nolint

return runner.Inner.InstallProvisioners(nodeConfig.Spec.Kubernetes.Provisioners)
}
2 changes: 1 addition & 1 deletion experiments/swdt/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func RunSetup(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer runner.CloseConnection() //nolint
defer runner.CloseConnection() // nolint

// Install choco binary
if err = runner.Inner.InstallChoco(); err != nil {
Expand Down
22 changes: 14 additions & 8 deletions experiments/swdt/pkg/connections/tests/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests
import (
"fmt"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
"log"
"net"
)
Expand Down Expand Up @@ -54,8 +54,11 @@ KaT3SUfkvAKQEAAAAOYWtuYWJiZW5AaG9ydXMBAgMEBQ==
)

func NewServer(hostname, expected string) {
var err error
config := &ssh.ServerConfig{PasswordCallback: passwordCallback}
parsePrivateKey(config, privateKey)
if err = parsePrivateKey(config, privateKey); err != nil {
log.Fatal(err)
}

listener, err := net.Listen("tcp", hostname)
if err != nil {
Expand Down Expand Up @@ -84,10 +87,13 @@ func acceptConnection(listener net.Listener, config *ssh.ServerConfig, result st

go handleRequest(requests, channel)

term := terminal.NewTerminal(channel, "")
term.Write([]byte(result))
term.ReadLine()
channel.Close()
t := term.NewTerminal(channel, "")
_, err = t.Write([]byte(result))
if err != nil {
log.Fatalf("error writing channel: %v", err)
}
t.ReadLine() // nolint
channel.Close() // nolint
}
}
}
Expand All @@ -96,9 +102,9 @@ func handleRequest(in <-chan *ssh.Request, channel ssh.Channel) {
for req := range in {
switch req.Type {
case "exec":
channel.SendRequest("exit-status", false, []byte{0, 0, 0, 0})
channel.SendRequest("exit-status", false, []byte{0, 0, 0, 0}) // nolint
}
req.Reply(req.Type == "exec", nil)
req.Reply(req.Type == "exec", nil) // nolint
}
}

Expand Down
2 changes: 1 addition & 1 deletion experiments/swdt/pkg/pwsh/kubernetes/provisioners.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package kubernetes
import (
"fmt"
"github.com/fatih/color"
"k8s.io/klog/v2"
klog "k8s.io/klog/v2"
"swdt/apis/config/v1alpha1"
"swdt/pkg/connections"
)
Expand Down
1 change: 0 additions & 1 deletion experiments/swdt/pkg/pwsh/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
var (
mainc = color.New(color.FgHiBlack).Add(color.Underline)
resc = color.New(color.FgHiGreen).Add(color.Bold)
errc = color.New(color.FgHiRed)
)

const (
Expand Down

0 comments on commit 6b626f5

Please sign in to comment.