Skip to content

Commit

Permalink
all: fix TODO comment hanging indents
Browse files Browse the repository at this point in the history
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 golang#51082.

Change-Id: Ibf5145659a61ebf9496f016752a709a7656d2d4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/384258
Trust: Russ Cox <[email protected]>
Run-TryBot: Russ Cox <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
rsc committed Apr 1, 2022
1 parent 7d87ccc commit 89dff11
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ package ssa

// TODO(matloob): Choose better names for Fun, Bloc, Goto, etc.
// 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 (
"cmd/compile/internal/types"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/syntax/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (simpleStmt) aSimpleStmt() {}
// Comments

// 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

const (
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/syntax/pos.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Pos struct {
func MakePos(base *PosBase, line, col uint) Pos { return Pos{base, sat32(line), sat32(col)} }

// 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) IsKnown() bool { return pos.line > 0 }
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/syntax/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func contains(tokset uint64, tok token) bool {
type LitKind uint8

// TODO(gri) With the 'i' (imaginary) suffix now permitted on integer
// and floating-point numbers, having a single ImagLit does
// not represent the literal kind well anymore. Remove it?
// and floating-point numbers, having a single ImagLit does
// not represent the literal kind well anymore. Remove it?
const (
IntLit LitKind = iota
FloatLit
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/syntax/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// walked multiple times.
// 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) {
walker{v}.node(root)
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/types2/assignments.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ func (check *Checker) assignVars(lhs, orig_rhs []syntax.Expr) {
// unpack unpacks a *syntax.ListExpr into a list of syntax.Expr.
// Helper introduced for the go/types -> types2 port.
// TODO(gri) Should find a more efficient solution that doesn't
// require introduction of a new slice for simple
// expressions.
// require introduction of a new slice for simple
// expressions.
func unpackExpr(x syntax.Expr) []syntax.Expr {
if x, _ := x.(*syntax.ListExpr); x != nil {
return x.ElemList
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/compile/internal/types2/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported
// indirectly via different packages.)
// indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported
// indirectly via different packages.)

// lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod.
// If foldCase is true, the lookup for methods will include looking for any method
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/types2/named.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

// 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.
// The result is non-nil for an (originally) generic type even if it is instantiated.
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/types2/return.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ func (check *Checker) isTerminatingSwitch(body []*syntax.CaseClause, label strin
}

// TODO(gri) For nested breakable statements, the current implementation of hasBreak
// will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase.
// will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase.

// hasBreak reports if s is or contains a break statement
// referring to the label-ed statement or implicit-ly the
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/types2/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ L:
}

// 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) {
// var dummy operand
Expand Down
10 changes: 5 additions & 5 deletions src/cmd/compile/internal/types2/validtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func (env *tparamEnv) push(typ *Named) *tparamEnv {
}

// TODO(gri) Alternative implementation:
// We may not need to build a stack of environments to
// look up the type arguments for type parameters. The
// same information should be available via the path:
// We should be able to just walk the path backwards
// and find the type arguments in the instance objects.
// We may not need to build a stack of environments to
// look up the type arguments for type parameters. The
// same information should be available via the path:
// We should be able to just walk the path backwards
// and find the type arguments in the instance objects.
2 changes: 1 addition & 1 deletion src/go/ast/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func walkDeclList(v Visitor, list []Decl) {
}

// 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
// v.Visit(node); node must not be nil. If the visitor w returned by
Expand Down
6 changes: 3 additions & 3 deletions src/go/constant/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ type Value interface {
const prec = 512

// TODO(gri) Consider storing "error" information in an unknownVal so clients
// can provide better error messages. For instance, if a number is
// too large (incl. infinity), that could be recorded in unknownVal.
// See also #20583 and #42695 for use cases.
// can provide better error messages. For instance, if a number is
// too large (incl. infinity), that could be recorded in unknownVal.
// See also #20583 and #42695 for use cases.

// Representation of values:
//
Expand Down
4 changes: 2 additions & 2 deletions src/go/parser/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"testing"
)

// TODO(rFindley): use a testdata file or file from another package here, to
// avoid a moving target.
// TODO(rfindley): use a testdata file or file from another package here, to
// avoid a moving target.
var src = readFile("parser.go")

func readFile(filename string) []byte {
Expand Down
14 changes: 7 additions & 7 deletions src/go/printer/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ import (
// printed.
//
// TODO(gri): linebreak may add too many lines if the next statement at "line"
// is preceded by comments because the computation of n assumes
// the current position before the comment and the target position
// after the comment. Thus, after interspersing such comments, the
// 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
// future (not yet interspersed) comments in this function.
// is preceded by comments because the computation of n assumes
// the current position before the comment and the target position
// after the comment. Thus, after interspersing such comments, the
// 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
// future (not yet interspersed) comments in this function.
//
func (p *printer) linebreak(line, min int, ws whiteSpace, newSection bool) (nbreaks int) {
n := nlimit(line - p.pos.Line)
Expand Down Expand Up @@ -125,7 +125,7 @@ const filteredMsg = "contains filtered or unexported fields"
// expressions.
//
// 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).
func (p *printer) exprList(prev0 token.Pos, list []ast.Expr, depth int, mode exprListMode, next0 token.Pos, isIncomplete bool) {
if len(list) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/go/printer/testdata/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
// 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 {
if p.trace {
defer un(trace(p, "Expression"))
Expand Down
6 changes: 3 additions & 3 deletions src/go/types/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported
// indirectly via different packages.)
// indexed by unique keys for a given type. Verify that named
// types always have only one representation (even when imported
// indirectly via different packages.)

// lookupFieldOrMethod should only be called by LookupFieldOrMethod and missingMethod.
// If foldCase is true, the lookup for methods will include looking for any method
Expand Down
2 changes: 1 addition & 1 deletion src/go/types/named.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (t *Named) Obj() *TypeName {
func (t *Named) Origin() *Named { return t.orig }

// 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.
// The result is non-nil for an (originally) generic type even if it is instantiated.
Expand Down
4 changes: 2 additions & 2 deletions src/go/types/return.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase.
// will traverse the same subtree repeatedly, once for each label. Replace
// with a single-pass label/break matching phase.

// hasBreak reports if s is or contains a break statement
// referring to the label-ed statement or implicit-ly the
Expand Down
2 changes: 1 addition & 1 deletion src/go/types/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ L:
}

// 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) {
// var dummy operand
Expand Down
10 changes: 5 additions & 5 deletions src/go/types/validtype.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (env *tparamEnv) push(typ *Named) *tparamEnv {
}

// TODO(gri) Alternative implementation:
// We may not need to build a stack of environments to
// look up the type arguments for type parameters. The
// same information should be available via the path:
// We should be able to just walk the path backwards
// and find the type arguments in the instance objects.
// We may not need to build a stack of environments to
// look up the type arguments for type parameters. The
// same information should be available via the path:
// We should be able to just walk the path backwards
// and find the type arguments in the instance objects.
2 changes: 1 addition & 1 deletion src/math/big/arith_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ func testFunVWW(t *testing.T, msg string, f funVWW, a argVWW) {
}

// 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 argWVW struct {
Expand Down
2 changes: 1 addition & 1 deletion src/net/http/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (
)

// 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".
var hostPortHandler = HandlerFunc(func(w ResponseWriter, r *Request) {
Expand Down
2 changes: 1 addition & 1 deletion src/reflect/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ func (t *structType) Field(i int) (f StructField) {
}

// 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.
func (t *structType) FieldByIndex(index []int) (f StructField) {
Expand Down

0 comments on commit 89dff11

Please sign in to comment.