1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:10:23 -07:00

all: fix TODO comment hanging indents

For whatever reason (perhaps some tool does this), a handful of comments,
including some doc comments, have TODOs formatted like:

	// TODO(name): Text here and
	//             more text aligned
	//             under first text.

In doc comments the second line turns into a <pre> block,
which is undesirable in this context.

Rewrite those to unindent, like this instead:

	// TODO(name): Text here and
	// more text aligned
	// at left column.

For #51082.

Change-Id: Ibf5145659a61ebf9496f016752a709a7656d2d4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/384258
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Russ Cox 2022-01-30 19:22:46 -05:00
parent 7d87ccc860
commit 89dff118ad
24 changed files with 49 additions and 49 deletions

View File

@ -34,7 +34,7 @@ package ssa
// TODO(matloob): Choose better names for Fun, Bloc, Goto, etc. // TODO(matloob): Choose better names for Fun, Bloc, Goto, etc.
// TODO(matloob): Write a parser for the Func disassembly. Maybe // TODO(matloob): Write a parser for the Func disassembly. Maybe
// the parser can be used instead of Fun. // the parser can be used instead of Fun.
import ( import (
"cmd/compile/internal/types" "cmd/compile/internal/types"

View File

@ -462,7 +462,7 @@ func (simpleStmt) aSimpleStmt() {}
// Comments // Comments
// TODO(gri) Consider renaming to CommentPos, CommentPlacement, etc. // TODO(gri) Consider renaming to CommentPos, CommentPlacement, etc.
// Kind = Above doesn't make much sense. // Kind = Above doesn't make much sense.
type CommentKind uint type CommentKind uint
const ( const (

View File

@ -24,7 +24,7 @@ type Pos struct {
func MakePos(base *PosBase, line, col uint) Pos { return Pos{base, sat32(line), sat32(col)} } func MakePos(base *PosBase, line, col uint) Pos { return Pos{base, sat32(line), sat32(col)} }
// TODO(gri) IsKnown makes an assumption about linebase < 1. // TODO(gri) IsKnown makes an assumption about linebase < 1.
// Maybe we should check for Base() != nil instead. // Maybe we should check for Base() != nil instead.
func (pos Pos) Pos() Pos { return pos } func (pos Pos) Pos() Pos { return pos }
func (pos Pos) IsKnown() bool { return pos.line > 0 } func (pos Pos) IsKnown() bool { return pos.line > 0 }

View File

@ -93,8 +93,8 @@ func contains(tokset uint64, tok token) bool {
type LitKind uint8 type LitKind uint8
// TODO(gri) With the 'i' (imaginary) suffix now permitted on integer // TODO(gri) With the 'i' (imaginary) suffix now permitted on integer
// and floating-point numbers, having a single ImagLit does // and floating-point numbers, having a single ImagLit does
// not represent the literal kind well anymore. Remove it? // not represent the literal kind well anymore. Remove it?
const ( const (
IntLit LitKind = iota IntLit LitKind = iota
FloatLit FloatLit

View File

@ -52,7 +52,7 @@ func Crawl(root Node, f func(Node) bool) {
// field lists such as type T in "a, b, c T"). Such shared nodes are // field lists such as type T in "a, b, c T"). Such shared nodes are
// walked multiple times. // walked multiple times.
// TODO(gri) Revisit this design. It may make sense to walk those nodes // TODO(gri) Revisit this design. It may make sense to walk those nodes
// only once. A place where this matters is types2.TestResolveIdents. // only once. A place where this matters is types2.TestResolveIdents.
func Walk(root Node, v Visitor) { func Walk(root Node, v Visitor) {
walker{v}.node(root) walker{v}.node(root)
} }

View File

@ -441,8 +441,8 @@ func (check *Checker) assignVars(lhs, orig_rhs []syntax.Expr) {
// unpack unpacks a *syntax.ListExpr into a list of syntax.Expr. // unpack unpacks a *syntax.ListExpr into a list of syntax.Expr.
// Helper introduced for the go/types -> types2 port. // Helper introduced for the go/types -> types2 port.
// TODO(gri) Should find a more efficient solution that doesn't // TODO(gri) Should find a more efficient solution that doesn't
// require introduction of a new slice for simple // require introduction of a new slice for simple
// expressions. // expressions.
func unpackExpr(x syntax.Expr) []syntax.Expr { func unpackExpr(x syntax.Expr) []syntax.Expr {
if x, _ := x.(*syntax.ListExpr); x != nil { if x, _ := x.(*syntax.ListExpr); x != nil {
return x.ElemList return x.ElemList

View File

@ -83,9 +83,9 @@ func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (o
} }
// TODO(gri) The named type consolidation and seen maps below must be // TODO(gri) The named type consolidation and seen maps below must be
// indexed by unique keys for a given type. Verify that named // indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported // types always have only one representation (even when imported
// indirectly via different packages.) // indirectly via different packages.)
// lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod. // lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod.
// If foldCase is true, the lookup for methods will include looking for any method // If foldCase is true, the lookup for methods will include looking for any method

View File

@ -107,7 +107,7 @@ func (t *Named) Obj() *TypeName { return t.orig.obj } // for non-instances this
func (t *Named) Origin() *Named { return t.orig } func (t *Named) Origin() *Named { return t.orig }
// TODO(gri) Come up with a better representation and API to distinguish // TODO(gri) Come up with a better representation and API to distinguish
// between parameterized instantiated and non-instantiated types. // between parameterized instantiated and non-instantiated types.
// TypeParams returns the type parameters of the named type t, or nil. // TypeParams returns the type parameters of the named type t, or nil.
// The result is non-nil for an (originally) generic type even if it is instantiated. // The result is non-nil for an (originally) generic type even if it is instantiated.

View File

@ -99,8 +99,8 @@ func (check *Checker) isTerminatingSwitch(body []*syntax.CaseClause, label strin
} }
// TODO(gri) For nested breakable statements, the current implementation of hasBreak // TODO(gri) For nested breakable statements, the current implementation of hasBreak
// will traverse the same subtree repeatedly, once for each label. Replace // will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase. // with a single-pass label/break matching phase.
// hasBreak reports if s is or contains a break statement // hasBreak reports if s is or contains a break statement
// referring to the label-ed statement or implicit-ly the // referring to the label-ed statement or implicit-ly the

View File

@ -312,7 +312,7 @@ L:
} }
// TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead. // TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead.
// (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.) // (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.)
// //
// func (check *Checker) caseTypes(x *operand, xtyp *Interface, types []syntax.Expr, seen map[string]syntax.Expr) (T Type) { // func (check *Checker) caseTypes(x *operand, xtyp *Interface, types []syntax.Expr, seen map[string]syntax.Expr) (T Type) {
// var dummy operand // var dummy operand

View File

@ -141,8 +141,8 @@ func (env *tparamEnv) push(typ *Named) *tparamEnv {
} }
// TODO(gri) Alternative implementation: // TODO(gri) Alternative implementation:
// We may not need to build a stack of environments to // We may not need to build a stack of environments to
// look up the type arguments for type parameters. The // look up the type arguments for type parameters. The
// same information should be available via the path: // same information should be available via the path:
// We should be able to just walk the path backwards // We should be able to just walk the path backwards
// and find the type arguments in the instance objects. // and find the type arguments in the instance objects.

View File

@ -40,7 +40,7 @@ func walkDeclList(v Visitor, list []Decl) {
} }
// TODO(gri): Investigate if providing a closure to Walk leads to // TODO(gri): Investigate if providing a closure to Walk leads to
// simpler use (and may help eliminate Inspect in turn). // simpler use (and may help eliminate Inspect in turn).
// Walk traverses an AST in depth-first order: It starts by calling // Walk traverses an AST in depth-first order: It starts by calling
// v.Visit(node); node must not be nil. If the visitor w returned by // v.Visit(node); node must not be nil. If the visitor w returned by

View File

@ -70,9 +70,9 @@ type Value interface {
const prec = 512 const prec = 512
// TODO(gri) Consider storing "error" information in an unknownVal so clients // TODO(gri) Consider storing "error" information in an unknownVal so clients
// can provide better error messages. For instance, if a number is // can provide better error messages. For instance, if a number is
// too large (incl. infinity), that could be recorded in unknownVal. // too large (incl. infinity), that could be recorded in unknownVal.
// See also #20583 and #42695 for use cases. // See also #20583 and #42695 for use cases.
// Representation of values: // Representation of values:
// //

View File

@ -10,8 +10,8 @@ import (
"testing" "testing"
) )
// TODO(rFindley): use a testdata file or file from another package here, to // TODO(rfindley): use a testdata file or file from another package here, to
// avoid a moving target. // avoid a moving target.
var src = readFile("parser.go") var src = readFile("parser.go")
func readFile(filename string) []byte { func readFile(filename string) []byte {

View File

@ -38,12 +38,12 @@ import (
// printed. // printed.
// //
// TODO(gri): linebreak may add too many lines if the next statement at "line" // TODO(gri): linebreak may add too many lines if the next statement at "line"
// is preceded by comments because the computation of n assumes // is preceded by comments because the computation of n assumes
// the current position before the comment and the target position // the current position before the comment and the target position
// after the comment. Thus, after interspersing such comments, the // after the comment. Thus, after interspersing such comments, the
// space taken up by them is not considered to reduce the number of // space taken up by them is not considered to reduce the number of
// linebreaks. At the moment there is no easy way to know about // linebreaks. At the moment there is no easy way to know about
// future (not yet interspersed) comments in this function. // future (not yet interspersed) comments in this function.
// //
func (p *printer) linebreak(line, min int, ws whiteSpace, newSection bool) (nbreaks int) { func (p *printer) linebreak(line, min int, ws whiteSpace, newSection bool) (nbreaks int) {
n := nlimit(line - p.pos.Line) n := nlimit(line - p.pos.Line)
@ -125,7 +125,7 @@ const filteredMsg = "contains filtered or unexported fields"
// expressions. // expressions.
// //
// TODO(gri) Consider rewriting this to be independent of []ast.Expr // TODO(gri) Consider rewriting this to be independent of []ast.Expr
// so that we can use the algorithm for any kind of list // so that we can use the algorithm for any kind of list
// (e.g., pass list via a channel over which to range). // (e.g., pass list via a channel over which to range).
func (p *printer) exprList(prev0 token.Pos, list []ast.Expr, depth int, mode exprListMode, next0 token.Pos, isIncomplete bool) { func (p *printer) exprList(prev0 token.Pos, list []ast.Expr, depth int, mode exprListMode, next0 token.Pos, isIncomplete bool) {
if len(list) == 0 { if len(list) == 0 {

View File

@ -1352,7 +1352,7 @@ func (p *parser) parseBinaryExpr(lhs bool, prec1 int) ast.Expr {
// If lhs is set and the result is an identifier, it is not resolved. // If lhs is set and the result is an identifier, it is not resolved.
// TODO(gri): parseExpr may return a type or even a raw type ([..]int) - // TODO(gri): parseExpr may return a type or even a raw type ([..]int) -
// should reject when a type/raw type is obviously not allowed // should reject when a type/raw type is obviously not allowed
func (p *parser) parseExpr(lhs bool) ast.Expr { func (p *parser) parseExpr(lhs bool) ast.Expr {
if p.trace { if p.trace {
defer un(trace(p, "Expression")) defer un(trace(p, "Expression"))

View File

@ -83,9 +83,9 @@ func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (o
} }
// TODO(gri) The named type consolidation and seen maps below must be // TODO(gri) The named type consolidation and seen maps below must be
// indexed by unique keys for a given type. Verify that named // indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported // types always have only one representation (even when imported
// indirectly via different packages.) // indirectly via different packages.)
// lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod. // lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod.
// If foldCase is true, the lookup for methods will include looking for any method // If foldCase is true, the lookup for methods will include looking for any method

View File

@ -109,7 +109,7 @@ func (t *Named) Obj() *TypeName {
func (t *Named) Origin() *Named { return t.orig } func (t *Named) Origin() *Named { return t.orig }
// TODO(gri) Come up with a better representation and API to distinguish // TODO(gri) Come up with a better representation and API to distinguish
// between parameterized instantiated and non-instantiated types. // between parameterized instantiated and non-instantiated types.
// TypeParams returns the type parameters of the named type t, or nil. // TypeParams returns the type parameters of the named type t, or nil.
// The result is non-nil for an (originally) generic type even if it is instantiated. // The result is non-nil for an (originally) generic type even if it is instantiated.

View File

@ -101,8 +101,8 @@ func (check *Checker) isTerminatingSwitch(body *ast.BlockStmt, label string) boo
} }
// TODO(gri) For nested breakable statements, the current implementation of hasBreak // TODO(gri) For nested breakable statements, the current implementation of hasBreak
// will traverse the same subtree repeatedly, once for each label. Replace // will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase. // with a single-pass label/break matching phase.
// hasBreak reports if s is or contains a break statement // hasBreak reports if s is or contains a break statement
// referring to the label-ed statement or implicit-ly the // referring to the label-ed statement or implicit-ly the

View File

@ -317,7 +317,7 @@ L:
} }
// TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead. // TODO(gri) Once we are certain that typeHash is correct in all situations, use this version of caseTypes instead.
// (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.) // (Currently it may be possible that different types have identical names and import paths due to ImporterFrom.)
// //
// func (check *Checker) caseTypes(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) (T Type) { // func (check *Checker) caseTypes(x *operand, xtyp *Interface, types []ast.Expr, seen map[string]ast.Expr) (T Type) {
// var dummy operand // var dummy operand

View File

@ -140,8 +140,8 @@ func (env *tparamEnv) push(typ *Named) *tparamEnv {
} }
// TODO(gri) Alternative implementation: // TODO(gri) Alternative implementation:
// We may not need to build a stack of environments to // We may not need to build a stack of environments to
// look up the type arguments for type parameters. The // look up the type arguments for type parameters. The
// same information should be available via the path: // same information should be available via the path:
// We should be able to just walk the path backwards // We should be able to just walk the path backwards
// and find the type arguments in the instance objects. // and find the type arguments in the instance objects.

View File

@ -510,7 +510,7 @@ func testFunVWW(t *testing.T, msg string, f funVWW, a argVWW) {
} }
// TODO(gri) mulAddVWW and divWVW are symmetric operations but // TODO(gri) mulAddVWW and divWVW are symmetric operations but
// their signature is not symmetric. Try to unify. // their signature is not symmetric. Try to unify.
type funWVW func(z []Word, xn Word, x []Word, y Word) (r Word) type funWVW func(z []Word, xn Word, x []Word, y Word) (r Word)
type argWVW struct { type argWVW struct {

View File

@ -48,7 +48,7 @@ import (
) )
// TODO: test 5 pipelined requests with responses: 1) OK, 2) OK, Connection: Close // TODO: test 5 pipelined requests with responses: 1) OK, 2) OK, Connection: Close
// and then verify that the final 2 responses get errors back. // and then verify that the final 2 responses get errors back.
// hostPortHandler writes back the client's "host:port". // hostPortHandler writes back the client's "host:port".
var hostPortHandler = HandlerFunc(func(w ResponseWriter, r *Request) { var hostPortHandler = HandlerFunc(func(w ResponseWriter, r *Request) {

View File

@ -1267,7 +1267,7 @@ func (t *structType) Field(i int) (f StructField) {
} }
// TODO(gri): Should there be an error/bool indicator if the index // TODO(gri): Should there be an error/bool indicator if the index
// is wrong for FieldByIndex? // is wrong for FieldByIndex?
// FieldByIndex returns the nested field corresponding to index. // FieldByIndex returns the nested field corresponding to index.
func (t *structType) FieldByIndex(index []int) (f StructField) { func (t *structType) FieldByIndex(index []int) (f StructField) {