cmd: continue lint fixes.

This commit is contained in:
2025-11-16 01:32:19 -08:00
parent f31d74243f
commit 0f77bd49dc
44 changed files with 888 additions and 875 deletions

View File

@@ -1,16 +1,16 @@
package main
import (
"bufio"
"flag"
"fmt"
"io"
"errors"
"log"
"net"
"os"
"strings"
"sync"
"bufio"
"errors"
"flag"
"fmt"
"io"
"log"
"net"
"os"
"strings"
"sync"
"git.wntrmute.dev/kyle/goutils/lib"
"github.com/pkg/sftp"
@@ -83,7 +83,7 @@ func scanner(host string, in io.Reader, out io.Writer) {
}
}
func logError(host string, err error, format string, args ...interface{}) {
func logError(host string, err error, format string, args ...any) {
msg := fmt.Sprintf(format, args...)
log.Printf("[%s] FAILED: %s: %v\n", host, msg, err)
}
@@ -93,12 +93,12 @@ func exec(wg *sync.WaitGroup, user, host string, commands []string) {
defer func() {
for i := len(shutdown) - 1; i >= 0; i-- {
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
defer wg.Done()
conf := sshConfig(user)
@@ -150,12 +150,12 @@ func upload(wg *sync.WaitGroup, user, host, local, remote string) {
defer func() {
for i := len(shutdown) - 1; i >= 0; i-- {
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
defer wg.Done()
conf := sshConfig(user)
@@ -200,13 +200,13 @@ func upload(wg *sync.WaitGroup, user, host, local, remote string) {
fmt.Printf("[%s] wrote %d-byte chunk\n", host, n)
}
if errors.Is(err, io.EOF) {
break
} else if err != nil {
logError(host, err, "reading chunk")
return
}
}
if errors.Is(err, io.EOF) {
break
} else if err != nil {
logError(host, err, "reading chunk")
return
}
}
fmt.Printf("[%s] %s uploaded to %s\n", host, remote, local)
}
@@ -215,12 +215,12 @@ func download(wg *sync.WaitGroup, user, host, local, remote string) {
defer func() {
for i := len(shutdown) - 1; i >= 0; i-- {
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
err := shutdown[i]()
if err != nil && !errors.Is(err, io.EOF) {
logError(host, err, "shutting down")
}
}
}()
defer wg.Done()
conf := sshConfig(user)
@@ -266,12 +266,12 @@ func download(wg *sync.WaitGroup, user, host, local, remote string) {
fmt.Printf("[%s] wrote %d-byte chunk\n", host, n)
}
if errors.Is(err, io.EOF) {
break
} else if err != nil {
logError(host, err, "reading chunk")
return
}
if errors.Is(err, io.EOF) {
break
} else if err != nil {
logError(host, err, "reading chunk")
return
}
}
fmt.Printf("[%s] %s downloaded to %s\n", host, remote, local)
}