refactor: adopt strings.Cut and strings.SplitSeq

Applies what go fix now proposes, so make fmt is a no-op on a clean tree
instead of dirtying these two files on every run. Both rewrites are
equivalent: Cut's first result matches SplitN(s, sep, 2)[0], and SplitSeq
iterates the same substrings without building the intermediate slice.
This commit is contained in:
Julien Neuhart
2026-09-03 19:22:23 +02:00
parent 8a0de7d5d7
commit 23d59f3133
2 changed files with 2 additions and 2 deletions

View File

@@ -361,7 +361,7 @@ func TestSofficeProxyEnv_OverridesExisting(t *testing.T) {
// Old proxy values must be gone, not duplicated. Count exact-case keys. // Old proxy values must be gone, not duplicated. Count exact-case keys.
counts := map[string]int{} counts := map[string]int{}
for _, kv := range out { for _, kv := range out {
key := strings.SplitN(kv, "=", 2)[0] key, _, _ := strings.Cut(kv, "=")
counts[key]++ counts[key]++
} }
for _, key := range []string{"http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY", "no_proxy", "NO_PROXY"} { for _, key := range []string{"http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY", "no_proxy", "NO_PROXY"} {

View File

@@ -180,7 +180,7 @@ func (engine *PdfCpu) listImages(ctx context.Context, inputPath string) ([]pdfcp
// their second column is not a numeric object number. // their second column is not a numeric object number.
func parseImagesList(output string) []pdfcpuImage { func parseImagesList(output string) []pdfcpuImage {
var images []pdfcpuImage var images []pdfcpuImage
for _, line := range strings.Split(output, "\n") { for line := range strings.SplitSeq(output, "\n") {
cols := strings.Split(line, "│") cols := strings.Split(line, "│")
if len(cols) < 9 { if len(cols) < 9 {
continue continue