Skip to content

Commit

Permalink
re-vendor with go1.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Feb 11, 2025
1 parent 179a687 commit 1d79904
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions internal/govendor/go/doc/comment/std.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions internal/govendor/go/printer/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (p *printer) parameters(fields *ast.FieldList, mode paramMode) {
if closing := p.lineFor(fields.Closing); 0 < prevLine && prevLine < closing {
p.print(token.COMMA)
p.linebreak(closing, 0, ignore, true)
} else if mode == typeTParam && fields.NumFields() == 1 && combinesWithName(fields.List[0].Type) {
} else if mode == typeTParam && fields.NumFields() == 1 && combinesWithName(stripParensAlways(fields.List[0].Type)) {
// A type parameter list [P T] where the name P and the type expression T syntactically
// combine to another valid (value) expression requires a trailing comma, as in [P *T,]
// (or an enclosing interface as in [P interface(*T)]), so that the type parameter list
Expand All @@ -401,7 +401,7 @@ func (p *printer) parameters(fields *ast.FieldList, mode paramMode) {
// combinesWithName reports whether a name followed by the expression x
// syntactically combines to another valid (value) expression. For instance
// using *T for x, "name *T" syntactically appears as the expression x*T.
// On the other hand, using P|Q or *P|~Q for x, "name P|Q" or name *P|~Q"
// On the other hand, using P|Q or *P|~Q for x, "name P|Q" or "name *P|~Q"
// cannot be combined into a valid (value) expression.
func combinesWithName(x ast.Expr) bool {
switch x := x.(type) {
Expand All @@ -411,9 +411,7 @@ func combinesWithName(x ast.Expr) bool {
case *ast.BinaryExpr:
return combinesWithName(x.X) && !isTypeElem(x.Y)
case *ast.ParenExpr:
// name(x) combines but we are making sure at
// the call site that x is never parenthesized.
panic("unexpected parenthesized expression")
return !isTypeElem(x.X)
}
return false
}
Expand Down
6 changes: 3 additions & 3 deletions internal/govendor/go/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ const (
)

type commentInfo struct {
cindex int // current comment index
comment *ast.CommentGroup // = printer.comments[cindex]; or nil
commentOffset int // = printer.posFor(printer.comments[cindex].List[0].Pos()).Offset; or infinity
cindex int // index of the next comment
comment *ast.CommentGroup // = printer.comments[cindex-1]; or nil
commentOffset int // = printer.posFor(printer.comments[cindex-1].List[0].Pos()).Offset; or infinity
commentNewline bool // true if the comment group contains newlines
}

Expand Down
2 changes: 1 addition & 1 deletion internal/govendor/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
go1.23.0
go1.24.0

0 comments on commit 1d79904

Please sign in to comment.