Skip to content

Commit 92e2be6

Browse files
committed
internal/govendor: undo upstream change to use strings.CutPrefix
We still support Go 1.19, and this API was added in 1.20.
1 parent 04a7ba7 commit 92e2be6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

internal/govendor/go/printer/comment.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ func formatDocComment(list []*ast.Comment) []*ast.Comment {
3737
kind = "//"
3838
var b strings.Builder
3939
for _, c := range list {
40-
after, found := strings.CutPrefix(c.Text, "//")
41-
if !found {
40+
if !strings.HasPrefix(c.Text, "//") {
4241
return list
4342
}
4443
// Accumulate //go:build etc lines separately.
45-
if isDirective(after) {
44+
if isDirective(c.Text[2:]) {
4645
directives = append(directives, c)
4746
continue
4847
}
49-
b.WriteString(strings.TrimPrefix(after, " "))
48+
b.WriteString(strings.TrimPrefix(c.Text[2:], " "))
5049
b.WriteString("\n")
5150
}
5251
text = b.String()

0 commit comments

Comments
 (0)