Run 'go fix' to modernize code (#69)

This only updates to Go 1.21 baseline, which is what the module still
specifies as the minimum version. I'll need to run this again when
moving to Go 1.25 or 1.26 as minimum.
This commit is contained in:
Billy Keyes
2026-05-25 09:11:07 -07:00
committed by GitHub
parent 6d3702d6db
commit 08f3e635d6
9 changed files with 13 additions and 20 deletions
+5 -5
View File
@@ -186,9 +186,9 @@ func ParsePatchHeader(header string, options ...PatchHeaderOption) (*PatchHeader
}
var firstLine, rest string
if idx := strings.IndexByte(header, '\n'); idx >= 0 {
firstLine = header[:idx]
rest = header[idx+1:]
if before, after, ok := strings.Cut(header, "\n"); ok {
firstLine = before
rest = after
} else {
firstLine = header
rest = ""
@@ -362,8 +362,8 @@ func parseHeaderMail(mailLine string, r io.Reader, opts patchHeaderOptions) (*Pa
h := &PatchHeader{}
if strings.HasPrefix(mailLine, mailHeaderPrefix) {
mailLine = strings.TrimPrefix(mailLine, mailHeaderPrefix)
if after, ok := strings.CutPrefix(mailLine, mailHeaderPrefix); ok {
mailLine = after
if i := strings.IndexByte(mailLine, ' '); i > 0 {
h.SHA = mailLine[:i]
}