Skip to content

Commit

Permalink
internal/govendor: undo upstream change to use strings.CutPrefix
Browse files Browse the repository at this point in the history
We still support Go 1.19, and this API was added in 1.20.
  • Loading branch information
mvdan committed Apr 8, 2023
1 parent 04a7ba7 commit 92e2be6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/govendor/go/printer/comment.go
Expand Up @@ -37,16 +37,15 @@ func formatDocComment(list []*ast.Comment) []*ast.Comment {
kind = "//"
var b strings.Builder
for _, c := range list {
after, found := strings.CutPrefix(c.Text, "//")
if !found {
if !strings.HasPrefix(c.Text, "//") {
return list
}
// Accumulate //go:build etc lines separately.
if isDirective(after) {
if isDirective(c.Text[2:]) {
directives = append(directives, c)
continue
}
b.WriteString(strings.TrimPrefix(after, " "))
b.WriteString(strings.TrimPrefix(c.Text[2:], " "))
b.WriteString("\n")
}
text = b.String()
Expand Down

0 comments on commit 92e2be6

Please sign in to comment.