mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: fix a lot of comments
Fix comments, including duplicate is, wrong phrases and articles, misspellings, etc. Change-Id: I8bfea53b9b275e649757cc4bee6a8a026ed9c7a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/493035 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
dc0179bfa8
commit
57e3189821
20 changed files with 26 additions and 26 deletions
|
|
@ -443,7 +443,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop {
|
||||||
return transformed
|
return transformed
|
||||||
}
|
}
|
||||||
|
|
||||||
// forAllDefInInitUpdate applies "do" to all the defining assignemnts in the Init clause of a ForStmt.
|
// forAllDefInInitUpdate applies "do" to all the defining assignments in the Init clause of a ForStmt.
|
||||||
// This abstracts away some of the boilerplate from the already complex and verbose for-3-clause case.
|
// This abstracts away some of the boilerplate from the already complex and verbose for-3-clause case.
|
||||||
func forAllDefInInitUpdate(x *ir.ForStmt, do func(z ir.Node, update *ir.Node)) {
|
func forAllDefInInitUpdate(x *ir.ForStmt, do func(z ir.Node, update *ir.Node)) {
|
||||||
for _, s := range x.Init() {
|
for _, s := range x.Init() {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ func (v *Value) AuxInt8() int8 {
|
||||||
|
|
||||||
func (v *Value) AuxUInt8() uint8 {
|
func (v *Value) AuxUInt8() uint8 {
|
||||||
if opcodeTable[v.Op].auxType != auxUInt8 {
|
if opcodeTable[v.Op].auxType != auxUInt8 {
|
||||||
v.Fatalf("op %s doesn't have an uint8 aux field", v.Op)
|
v.Fatalf("op %s doesn't have a uint8 aux field", v.Op)
|
||||||
}
|
}
|
||||||
return uint8(v.AuxInt)
|
return uint8(v.AuxInt)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -718,7 +718,7 @@ func (s *state) checkPtrAlignment(n *ir.ConvExpr, v *ssa.Value, count *ssa.Value
|
||||||
count = s.constInt(types.Types[types.TUINTPTR], 1)
|
count = s.constInt(types.Types[types.TUINTPTR], 1)
|
||||||
}
|
}
|
||||||
if count.Type.Size() != s.config.PtrSize {
|
if count.Type.Size() != s.config.PtrSize {
|
||||||
s.Fatalf("expected count fit to an uintptr size, have: %d, want: %d", count.Type.Size(), s.config.PtrSize)
|
s.Fatalf("expected count fit to a uintptr size, have: %d, want: %d", count.Type.Size(), s.config.PtrSize)
|
||||||
}
|
}
|
||||||
var rtype *ssa.Value
|
var rtype *ssa.Value
|
||||||
if rtypeExpr != nil {
|
if rtypeExpr != nil {
|
||||||
|
|
|
||||||
|
|
@ -576,7 +576,7 @@ func (w *tpWalker) isParameterized(typ Type) (res bool) {
|
||||||
// of a generic function type (or an interface method) that is
|
// of a generic function type (or an interface method) that is
|
||||||
// part of the type we're testing. We don't care about these type
|
// part of the type we're testing. We don't care about these type
|
||||||
// parameters.
|
// parameters.
|
||||||
// Similarly, the receiver of a method may declare (rather then
|
// Similarly, the receiver of a method may declare (rather than
|
||||||
// use) type parameters, we don't care about those either.
|
// use) type parameters, we don't care about those either.
|
||||||
// Thus, we only need to look at the input and result parameters.
|
// Thus, we only need to look at the input and result parameters.
|
||||||
return t.params != nil && w.varList(t.params.vars) || t.results != nil && w.varList(t.results.vars)
|
return t.params != nil && w.varList(t.params.vars) || t.results != nil && w.varList(t.results.vars)
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ func TestResolveIdents(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that each identifier in the source is found in uses or defs or both.
|
// Check that each identifier in the source is found in uses or defs or both.
|
||||||
// We need the foundUses/Defs maps (rather then just deleting the found objects
|
// We need the foundUses/Defs maps (rather than just deleting the found objects
|
||||||
// from the uses and defs maps) because syntax.Walk traverses shared nodes multiple
|
// from the uses and defs maps) because syntax.Walk traverses shared nodes multiple
|
||||||
// times (e.g. types in field lists such as "a, b, c int").
|
// times (e.g. types in field lists such as "a, b, c int").
|
||||||
foundUses := make(map[*syntax.Name]bool)
|
foundUses := make(map[*syntax.Name]bool)
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ func (u *unifier) nify(x, y Type, p *ifacePair) (result bool) {
|
||||||
// Unification will fail if we match a defined type against a type literal.
|
// Unification will fail if we match a defined type against a type literal.
|
||||||
// Per the (spec) assignment rules, assignments of values to variables with
|
// Per the (spec) assignment rules, assignments of values to variables with
|
||||||
// the same type structure are permitted as long as at least one of them
|
// the same type structure are permitted as long as at least one of them
|
||||||
// is not a defined type. To accomodate for that possibility, we continue
|
// is not a defined type. To accommodate for that possibility, we continue
|
||||||
// unification with the underlying type of a defined type if the other type
|
// unification with the underlying type of a defined type if the other type
|
||||||
// is a type literal.
|
// is a type literal.
|
||||||
// We also continue if the other type is a basic type because basic types
|
// We also continue if the other type is a basic type because basic types
|
||||||
|
|
|
||||||
|
|
@ -759,7 +759,7 @@ func walkIndex(n *ir.IndexExpr, init *ir.Nodes) ir.Node {
|
||||||
|
|
||||||
// mapKeyArg returns an expression for key that is suitable to be passed
|
// mapKeyArg returns an expression for key that is suitable to be passed
|
||||||
// as the key argument for runtime map* functions.
|
// as the key argument for runtime map* functions.
|
||||||
// n is is the map indexing or delete Node (to provide Pos).
|
// n is the map indexing or delete Node (to provide Pos).
|
||||||
func mapKeyArg(fast int, n, key ir.Node, assigned bool) ir.Node {
|
func mapKeyArg(fast int, n, key ir.Node, assigned bool) ir.Node {
|
||||||
if fast == mapslow {
|
if fast == mapslow {
|
||||||
// standard version takes key by reference.
|
// standard version takes key by reference.
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ func checkSemi(t *testing.T, input, want string, mode Mode) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if tok == token.SEMICOLON && lit != ";" {
|
if tok == token.SEMICOLON && lit != ";" {
|
||||||
// Artifical semicolon:
|
// Artificial semicolon:
|
||||||
// assert that position is EOF or that of a newline.
|
// assert that position is EOF or that of a newline.
|
||||||
off := file.Offset(pos)
|
off := file.Offset(pos)
|
||||||
if off != len(input) && input[off] != '\n' {
|
if off != len(input) && input[off] != '\n' {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (_ Type
|
||||||
// to compute types and values, but in addition to Check, as these
|
// to compute types and values, but in addition to Check, as these
|
||||||
// functions ignore the context in which an expression is used (e.g., an
|
// functions ignore the context in which an expression is used (e.g., an
|
||||||
// assignment). Thus, top-level untyped constants will return an
|
// assignment). Thus, top-level untyped constants will return an
|
||||||
// untyped type rather then the respective context-specific type.
|
// untyped type rather than the respective context-specific type.
|
||||||
func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
|
func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
|
||||||
// determine scope
|
// determine scope
|
||||||
var scope *Scope
|
var scope *Scope
|
||||||
|
|
|
||||||
|
|
@ -578,7 +578,7 @@ func (w *tpWalker) isParameterized(typ Type) (res bool) {
|
||||||
// of a generic function type (or an interface method) that is
|
// of a generic function type (or an interface method) that is
|
||||||
// part of the type we're testing. We don't care about these type
|
// part of the type we're testing. We don't care about these type
|
||||||
// parameters.
|
// parameters.
|
||||||
// Similarly, the receiver of a method may declare (rather then
|
// Similarly, the receiver of a method may declare (rather than
|
||||||
// use) type parameters, we don't care about those either.
|
// use) type parameters, we don't care about those either.
|
||||||
// Thus, we only need to look at the input and result parameters.
|
// Thus, we only need to look at the input and result parameters.
|
||||||
return t.params != nil && w.varList(t.params.vars) || t.results != nil && w.varList(t.results.vars)
|
return t.params != nil && w.varList(t.params.vars) || t.results != nil && w.varList(t.results.vars)
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ func (u *unifier) nify(x, y Type, p *ifacePair) (result bool) {
|
||||||
// Unification will fail if we match a defined type against a type literal.
|
// Unification will fail if we match a defined type against a type literal.
|
||||||
// Per the (spec) assignment rules, assignments of values to variables with
|
// Per the (spec) assignment rules, assignments of values to variables with
|
||||||
// the same type structure are permitted as long as at least one of them
|
// the same type structure are permitted as long as at least one of them
|
||||||
// is not a defined type. To accomodate for that possibility, we continue
|
// is not a defined type. To accommodate for that possibility, we continue
|
||||||
// unification with the underlying type of a defined type if the other type
|
// unification with the underlying type of a defined type if the other type
|
||||||
// is a type literal.
|
// is a type literal.
|
||||||
// We also continue if the other type is a basic type because basic types
|
// We also continue if the other type is a basic type because basic types
|
||||||
|
|
|
||||||
2
src/internal/types/testdata/check/errors.go
vendored
2
src/internal/types/testdata/check/errors.go
vendored
|
|
@ -58,7 +58,7 @@ func _() {
|
||||||
|
|
||||||
// Use unqualified names for package-local objects.
|
// Use unqualified names for package-local objects.
|
||||||
type T struct{}
|
type T struct{}
|
||||||
var _ int = T /* ERROR "value of type T" */ {} // use T in error message rather then errors.T
|
var _ int = T /* ERROR "value of type T" */ {} // use T in error message rather than errors.T
|
||||||
|
|
||||||
// Don't report errors containing "invalid type" (issue #24182).
|
// Don't report errors containing "invalid type" (issue #24182).
|
||||||
func _(x *missing /* ERROR "undefined: missing" */ ) {
|
func _(x *missing /* ERROR "undefined: missing" */ ) {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ func (z *Float) pow5(n uint64) *Float {
|
||||||
// no prefix is accepted. The octal prefix "0" is not supported (a leading
|
// no prefix is accepted. The octal prefix "0" is not supported (a leading
|
||||||
// "0" is simply considered a "0").
|
// "0" is simply considered a "0").
|
||||||
//
|
//
|
||||||
// A "p" or "P" exponent indicates a base 2 (rather then base 10) exponent;
|
// A "p" or "P" exponent indicates a base 2 (rather than base 10) exponent;
|
||||||
// for instance, "0x1.fffffffffffffp1023" (using base 0) represents the
|
// for instance, "0x1.fffffffffffffp1023" (using base 0) represents the
|
||||||
// maximum float64 value. For hexadecimal mantissae, the exponent character
|
// maximum float64 value. For hexadecimal mantissae, the exponent character
|
||||||
// must be one of 'p' or 'P', if present (an "e" or "E" exponent indicator
|
// must be one of 'p' or 'P', if present (an "e" or "E" exponent indicator
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ func expiresIn(delta int) string {
|
||||||
return "expires=" + t.Format(time.RFC1123)
|
return "expires=" + t.Format(time.RFC1123)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mustParseURL parses s to an URL and panics on error.
|
// mustParseURL parses s to a URL and panics on error.
|
||||||
func mustParseURL(s string) *url.URL {
|
func mustParseURL(s string) *url.URL {
|
||||||
u, err := url.Parse(s)
|
u, err := url.Parse(s)
|
||||||
if err != nil || u.Scheme == "" || u.Host == "" {
|
if err != nil || u.Scheme == "" || u.Host == "" {
|
||||||
|
|
@ -670,7 +670,7 @@ var updateAndDeleteTests = [...]jarTest{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Clear Secure flag from a http.",
|
"Clear Secure flag from an http.",
|
||||||
"http://www.host.test/",
|
"http://www.host.test/",
|
||||||
[]string{
|
[]string{
|
||||||
"b=xx",
|
"b=xx",
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ func TestQuery(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #25192: Test that ParseForm fails but still parses the form when an URL
|
// Issue #25192: Test that ParseForm fails but still parses the form when a URL
|
||||||
// containing a semicolon is provided.
|
// containing a semicolon is provided.
|
||||||
func TestParseFormSemicolonSeparator(t *testing.T) {
|
func TestParseFormSemicolonSeparator(t *testing.T) {
|
||||||
for _, method := range []string{"POST", "PATCH", "PUT", "GET"} {
|
for _, method := range []string{"POST", "PATCH", "PUT", "GET"} {
|
||||||
|
|
@ -379,7 +379,7 @@ func TestMultipartRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #25192: Test that ParseMultipartForm fails but still parses the
|
// Issue #25192: Test that ParseMultipartForm fails but still parses the
|
||||||
// multi-part form when an URL containing a semicolon is provided.
|
// multi-part form when a URL containing a semicolon is provided.
|
||||||
func TestParseMultipartFormSemicolonSeparator(t *testing.T) {
|
func TestParseMultipartFormSemicolonSeparator(t *testing.T) {
|
||||||
req := newTestMultipartRequest(t)
|
req := newTestMultipartRequest(t)
|
||||||
req.URL = &url.URL{RawQuery: "q=foo;q=bar"}
|
req.URL = &url.URL{RawQuery: "q=foo;q=bar"}
|
||||||
|
|
|
||||||
|
|
@ -2353,7 +2353,7 @@ func testTransportResponseHeaderTimeout(t *testing.T, mode testMode) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
uerr, ok := err.(*url.Error)
|
uerr, ok := err.(*url.Error)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Errorf("error is not an url.Error; got: %#v", err)
|
t.Errorf("error is not a url.Error; got: %#v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
nerr, ok := uerr.Err.(net.Error)
|
nerr, ok := uerr.Err.(net.Error)
|
||||||
|
|
@ -3889,7 +3889,7 @@ func TestTransportCloseIdleConnsThenReturn(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for issue 34282
|
// Test for issue 34282
|
||||||
// Ensure that getConn doesn't call the GotConn trace hook on a HTTP/2 idle conn
|
// Ensure that getConn doesn't call the GotConn trace hook on an HTTP/2 idle conn
|
||||||
func TestTransportTraceGotConnH2IdleConns(t *testing.T) {
|
func TestTransportTraceGotConnH2IdleConns(t *testing.T) {
|
||||||
tr := &Transport{}
|
tr := &Transport{}
|
||||||
wantIdle := func(when string, n int) bool {
|
wantIdle := func(when string, n int) bool {
|
||||||
|
|
@ -4952,7 +4952,7 @@ func TestTransportRejectsAlphaPort(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the httptrace.TLSHandshake{Start,Done} hooks with a https http1
|
// Test the httptrace.TLSHandshake{Start,Done} hooks with an https http1
|
||||||
// connections. The http2 test is done in TestTransportEventTrace_h2
|
// connections. The http2 test is done in TestTransportEventTrace_h2
|
||||||
func TestTLSHandshakeTrace(t *testing.T) {
|
func TestTLSHandshakeTrace(t *testing.T) {
|
||||||
run(t, testTLSHandshakeTrace, []testMode{https1Mode, http2Mode})
|
run(t, testTLSHandshakeTrace, []testMode{https1Mode, http2Mode})
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ def iface_dtype(obj):
|
||||||
return
|
return
|
||||||
|
|
||||||
type_size = int(dynamic_go_type['size'])
|
type_size = int(dynamic_go_type['size'])
|
||||||
uintptr_size = int(dynamic_go_type['size'].type.sizeof) # size is itself an uintptr
|
uintptr_size = int(dynamic_go_type['size'].type.sizeof) # size is itself a uintptr
|
||||||
if type_size > uintptr_size:
|
if type_size > uintptr_size:
|
||||||
dynamic_gdb_type = dynamic_gdb_type.pointer()
|
dynamic_gdb_type = dynamic_gdb_type.pointer()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -665,7 +665,7 @@ type p struct {
|
||||||
// We need an explicit length here because this field is used
|
// We need an explicit length here because this field is used
|
||||||
// in allocation codepaths where write barriers are not allowed,
|
// in allocation codepaths where write barriers are not allowed,
|
||||||
// and eliminating the write barrier/keeping it eliminated from
|
// and eliminating the write barrier/keeping it eliminated from
|
||||||
// slice updates is tricky, moreso than just managing the length
|
// slice updates is tricky, more so than just managing the length
|
||||||
// ourselves.
|
// ourselves.
|
||||||
len int
|
len int
|
||||||
buf [128]*mspan
|
buf [128]*mspan
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func (x *Int64) CompareAndSwap(old, new int64) (swapped bool) {
|
||||||
// Add atomically adds delta to x and returns the new value.
|
// Add atomically adds delta to x and returns the new value.
|
||||||
func (x *Int64) Add(delta int64) (new int64) { return AddInt64(&x.v, delta) }
|
func (x *Int64) Add(delta int64) (new int64) { return AddInt64(&x.v, delta) }
|
||||||
|
|
||||||
// An Uint32 is an atomic uint32. The zero value is zero.
|
// A Uint32 is an atomic uint32. The zero value is zero.
|
||||||
type Uint32 struct {
|
type Uint32 struct {
|
||||||
_ noCopy
|
_ noCopy
|
||||||
v uint32
|
v uint32
|
||||||
|
|
@ -134,7 +134,7 @@ func (x *Uint32) CompareAndSwap(old, new uint32) (swapped bool) {
|
||||||
// Add atomically adds delta to x and returns the new value.
|
// Add atomically adds delta to x and returns the new value.
|
||||||
func (x *Uint32) Add(delta uint32) (new uint32) { return AddUint32(&x.v, delta) }
|
func (x *Uint32) Add(delta uint32) (new uint32) { return AddUint32(&x.v, delta) }
|
||||||
|
|
||||||
// An Uint64 is an atomic uint64. The zero value is zero.
|
// A Uint64 is an atomic uint64. The zero value is zero.
|
||||||
type Uint64 struct {
|
type Uint64 struct {
|
||||||
_ noCopy
|
_ noCopy
|
||||||
_ align64
|
_ align64
|
||||||
|
|
@ -158,7 +158,7 @@ func (x *Uint64) CompareAndSwap(old, new uint64) (swapped bool) {
|
||||||
// Add atomically adds delta to x and returns the new value.
|
// Add atomically adds delta to x and returns the new value.
|
||||||
func (x *Uint64) Add(delta uint64) (new uint64) { return AddUint64(&x.v, delta) }
|
func (x *Uint64) Add(delta uint64) (new uint64) { return AddUint64(&x.v, delta) }
|
||||||
|
|
||||||
// An Uintptr is an atomic uintptr. The zero value is zero.
|
// A Uintptr is an atomic uintptr. The zero value is zero.
|
||||||
type Uintptr struct {
|
type Uintptr struct {
|
||||||
_ noCopy
|
_ noCopy
|
||||||
v uintptr
|
v uintptr
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ func appendCleanPath(buf []byte, path string, lookupParent bool) ([]byte, bool)
|
||||||
|
|
||||||
// joinPath concatenates dir and file paths, producing a cleaned path where
|
// joinPath concatenates dir and file paths, producing a cleaned path where
|
||||||
// "." and ".." have been removed, unless dir is relative and the references
|
// "." and ".." have been removed, unless dir is relative and the references
|
||||||
// to parent directories in file represented a location relatie to a parent
|
// to parent directories in file represented a location relative to a parent
|
||||||
// of dir.
|
// of dir.
|
||||||
//
|
//
|
||||||
// This function is used for path resolution of all wasi functions expecting
|
// This function is used for path resolution of all wasi functions expecting
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue