mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-10-29 15:02:30 +00:00
Apply go fix to simplify using modern features
This patch contains the result of running `go fix ./...`, which applies simplifications that make use of modern language features. There are no logic or behaviour changes.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// SMTP connection generator, for testing purposes.
|
||||
package main
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// Generate an HTML visualization of a Go coverage profile.
|
||||
// Serves a similar purpose to "go tool cover -html", but has a different
|
||||
@@ -25,7 +24,7 @@ var (
|
||||
notes = flag.String("notes", "", "notes to add at the beginning (HTML)")
|
||||
)
|
||||
|
||||
func errorf(f string, a ...interface{}) {
|
||||
func errorf(f string, a ...any) {
|
||||
fmt.Printf(f, a...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// Fetch an URL, and check if the response matches what we expect.
|
||||
//
|
||||
@@ -187,12 +186,12 @@ func mkTransport(caCert string) http.RoundTripper {
|
||||
}
|
||||
}
|
||||
|
||||
func fatalf(s string, a ...interface{}) {
|
||||
func fatalf(s string, a ...any) {
|
||||
fmt.Fprintf(os.Stderr, s, a...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func errorf(s string, a ...interface{}) {
|
||||
func errorf(s string, a ...any) {
|
||||
fmt.Fprintf(os.Stderr, s, a...)
|
||||
exitCode = 1
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// Utility to generate self-signed certificates.
|
||||
// It generates a self-signed x509 certificate and key pair, and writes them
|
||||
@@ -34,7 +33,7 @@ var (
|
||||
"Should this cert be its own CA?")
|
||||
)
|
||||
|
||||
func fatalf(f string, a ...interface{}) {
|
||||
func fatalf(f string, a ...any) {
|
||||
fmt.Printf(f, a...)
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -71,8 +70,8 @@ func main() {
|
||||
tmpl.IsCA = true
|
||||
}
|
||||
|
||||
hosts := strings.Split(*host, ",")
|
||||
for _, h := range hosts {
|
||||
hosts := strings.SplitSeq(*host, ",")
|
||||
for h := range hosts {
|
||||
if ip := net.ParseIP(h); ip != nil {
|
||||
tmpl.IPAddresses = append(tmpl.IPAddresses, ip)
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// SMTP load generator, for testing purposes.
|
||||
package main
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !coverage
|
||||
// +build !coverage
|
||||
|
||||
// minidns is a trivial DNS server used for testing.
|
||||
//
|
||||
@@ -63,11 +62,9 @@ func main() {
|
||||
srv.loadZones(zonesFile)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
srv.listenAndServeUDP(*addr)
|
||||
}()
|
||||
})
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
srv.listenAndServeTCP(*addr)
|
||||
|
||||
@@ -101,7 +101,7 @@ func loadConfig() {
|
||||
}
|
||||
notnil(err)
|
||||
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
for line := range strings.SplitSeq(string(data), "\n") {
|
||||
k, v, ok := strings.Cut(line, " ")
|
||||
if !ok {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user