From 141872ed80d6323505e7543628c259fdae8506d3 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 2 Aug 2022 16:39:09 -0400 Subject: chore: Bump up to Go 1.19, minimum 1.18 (#4925) --- modules/caddyhttp/staticresp.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'modules/caddyhttp/staticresp.go') diff --git a/modules/caddyhttp/staticresp.go b/modules/caddyhttp/staticresp.go index 9e12bd5..f0aea03 100644 --- a/modules/caddyhttp/staticresp.go +++ b/modules/caddyhttp/staticresp.go @@ -283,7 +283,7 @@ func cmdRespond(fl caddycmd.Flags) (int, error) { // build headers map hdr := make(http.Header) for i, h := range respondCmdHeaders { - key, val, found := cut(h, ":") // TODO: use strings.Cut() once Go 1.18 is our minimum + key, val, found := strings.Cut(h, ":") key, val = strings.TrimSpace(key), strings.TrimSpace(val) if !found || key == "" || val == "" { return caddy.ExitCodeFailedStartup, fmt.Errorf("header %d: invalid format \"%s\" (expecting \"Field: value\")", i, h) @@ -395,14 +395,6 @@ func cmdRespond(fl caddycmd.Flags) (int, error) { select {} } -// TODO: delete this and use strings.Cut() once Go 1.18 is our minimum -func cut(s, sep string) (before, after string, found bool) { - if i := strings.Index(s, sep); i >= 0 { - return s[:i], s[i+len(sep):], true - } - return s, "", false -} - // respondCmdHeaders holds the parsed values from repeated use of the --header flag. var respondCmdHeaders caddycmd.StringSlice -- cgit v1.2.3