1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-10-29 15:02:30 +00:00

Apply more mechanical simplifications using recent Go features

This is a follow-up on the `go fix` run in commit
0210c5fd92.

That commit recorded the automated updates.

This one applies further simplifications that are mechanical and do not
involve logic changes, but are outside of what `go fix` did.

It also removes some now-obsolete comments and statements.
This commit is contained in:
Alberto Bertogli
2026-10-03 09:08:22 +01:00
parent 0210c5fd92
commit 8d763f450d
33 changed files with 99 additions and 161 deletions
+1 -6
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// SMTP connection generator, for testing purposes.
package main
@@ -8,7 +6,6 @@ import (
"net"
"net/http"
"net/smtp"
"time"
_ "net/http/pprof"
@@ -66,9 +63,7 @@ func main() {
log.Infof("done, created %d simultaneous connections", *count)
if *wait {
for {
time.Sleep(24 * time.Hour)
}
select {}
}
for _, c := range conns {
-2
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// Generate an HTML visualization of a Go coverage profile.
// Serves a similar purpose to "go tool cover -html", but has a different
// visual style.
+3 -9
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// Fetch an URL, and check if the response matches what we expect.
//
// Useful for testing HTTP(s) servers.
@@ -11,10 +9,11 @@ import (
"flag"
"fmt"
"io"
"maps"
"net/http"
"os"
"regexp"
"sort"
"slices"
"strconv"
"strings"
)
@@ -85,12 +84,7 @@ func main() {
fmt.Printf("Request: %s\n", url)
fmt.Printf("Response:\n")
fmt.Printf(" %v %v\n", resp.Proto, resp.Status)
ks := []string{}
for k := range resp.Header {
ks = append(ks, k)
}
sort.Strings(ks)
for _, k := range ks {
for _, k := range slices.Sorted(maps.Keys(resp.Header)) {
fmt.Printf(" %v: %s\n", k,
strings.Join(resp.Header[k], ", "))
}
-2
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// Utility to generate self-signed certificates.
// It generates a self-signed x509 certificate and key pair, and writes them
// to "fullchain.pem" and "privkey.pem".
+1 -5
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// SMTP load generator, for testing purposes.
package main
@@ -114,9 +112,7 @@ func main() {
)
if *wait {
for {
time.Sleep(24 * time.Hour)
}
select {}
}
}
-2
View File
@@ -1,5 +1,3 @@
//go:build !coverage
// minidns is a trivial DNS server used for testing.
//
// It takes an "answers" file which contains lines with the following format: