Skip to content

Commit

Permalink
all: fix misuses of "a" vs "an"
Browse files Browse the repository at this point in the history
Fixes the misuse of "a" vs "an", according to English grammatical
expectations and using https://www.a-or-an.com/

Change-Id: I53ac724070e3ff3d33c304483fe72c023c7cda47
Reviewed-on: https://go-review.googlesource.com/c/go/+/480536
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
  • Loading branch information
cuishuang authored and gopherbot committed Apr 4, 2023
1 parent f62c970 commit d8d2266
Show file tree
Hide file tree
Showing 31 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/archive/zip/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const (
//
// IDs 0..31 are reserved for official use by PKWARE.
// IDs above that range are defined by third-party vendors.
// Since ZIP lacked high precision timestamps (nor a official specification
// Since ZIP lacked high precision timestamps (nor an official specification
// of the timezone used for the date fields), many competing extra fields
// have been invented. Pervasive use effectively makes them "official".
//
Expand Down
2 changes: 1 addition & 1 deletion src/bytes/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (b *Buffer) Reset() {
b.lastRead = opInvalid
}

// tryGrowByReslice is a inlineable version of grow for the fast-case where the
// tryGrowByReslice is an inlineable version of grow for the fast-case where the
// internal buffer only needs to be resliced.
// It returns the index where bytes should be written and whether it succeeded.
func (b *Buffer) tryGrowByReslice(n int) (int, bool) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/abt/avlint32.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (t *node32) lub(key int32, allow_eq bool) *node32 {
// t is too small, lub is to right.
t = t.right
} else {
// t is a upper bound, record it and seek a better one.
// t is an upper bound, record it and seek a better one.
best = t
t = t.left
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ir/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (n *InlinedCallExpr) SingleResult() Node {
return n.ReturnVars[0]
}

// A LogicalExpr is a expression X Op Y where Op is && or ||.
// A LogicalExpr is an expression X Op Y where Op is && or ||.
// It is separate from BinaryExpr to make room for statements
// that must be executed before Y but after X.
type LogicalExpr struct {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ir/val.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func Int64Val(n Node) int64 {
return x
}

// Uint64Val returns n as an uint64.
// Uint64Val returns n as a uint64.
// n must be an integer or rune constant.
func Uint64Val(n Node) uint64 {
if !IsConst(n, constant.Int) {
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/compile/internal/ssa/loopbce.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func findIndVar(f *Func) []indVar {
var init *Value // starting value
var limit *Value // ending value

// Check thet the control if it either ind </<= limit or limit </<= ind.
// Check that the control if it either ind </<= limit or limit </<= ind.
// TODO: Handle unsigned comparisons?
c := b.Controls[0]
inclusive := false
Expand All @@ -117,12 +117,12 @@ func findIndVar(f *Func) []indVar {
// for i := len(n)-1; i >= 0; i--
init, inc, nxt = parseIndVar(limit)
if init == nil {
// No recognied induction variable on either operand
// No recognized induction variable on either operand
continue
}

// Ok, the arguments were reversed. Swap them, and remember that we're
// looking at a ind >/>= loop (so the induction must be decrementing).
// looking at an ind >/>= loop (so the induction must be decrementing).
ind, limit = limit, ind
less = false
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ const (
auxARM64BitField // aux is an arm64 bitfield lsb and width packed into auxInt
auxS390XRotateParams // aux is a s390x rotate parameters object encoding start bit, end bit and rotate amount
auxS390XCCMask // aux is a s390x 4-bit condition code mask
auxS390XCCMaskInt8 // aux is a s390x 4-bit condition code mask, auxInt is a int8 immediate
auxS390XCCMaskInt8 // aux is a s390x 4-bit condition code mask, auxInt is an int8 immediate
auxS390XCCMaskUint8 // aux is a s390x 4-bit condition code mask, auxInt is a uint8 immediate
)

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/poset.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
)

// posetUndo represents an undo pass to be performed.
// It's an union of fields that can be used to store information,
// It's a union of fields that can be used to store information,
// and typ is the discriminant, that specifies which kind
// of operation must be performed. Not all fields are always used.
type posetUndo struct {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ func (t *Type) IsUnsafePtr() bool {
return t.kind == TUNSAFEPTR
}

// IsUintptr reports whether t is an uintptr.
// IsUintptr reports whether t is a uintptr.
func (t *Type) IsUintptr() bool {
return t.kind == TUINTPTR
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/walk/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func isAppendOfMake(n ir.Node) bool {
}

// y must be either an integer constant or the largest possible positive value
// of variable y needs to fit into an uint.
// of variable y needs to fit into a uint.

// typecheck made sure that constant arguments to make are not negative and fit into an int.

Expand Down Expand Up @@ -652,7 +652,7 @@ func isAppendOfMake(n ir.Node) bool {
// growslice will have done the clearing for us.

func extendSlice(n *ir.CallExpr, init *ir.Nodes) ir.Node {
// isAppendOfMake made sure all possible positive values of l2 fit into an uint.
// isAppendOfMake made sure all possible positive values of l2 fit into a uint.
// The case of l2 overflow when converting from e.g. uint to int is handled by an explicit
// check of l2 < 0 at runtime which is generated below.
l2 := typecheck.Conv(n.Args[1].(*ir.MakeExpr).Len, types.Types[types.TINT])
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/obj/ppc64/asm9.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func addpad(pc, a int64, ctxt *obj.Link, cursym *obj.LSym) int {
return 0
}

// Get the implied register of a operand which doesn't specify one. These show up
// Get the implied register of an operand which doesn't specify one. These show up
// in handwritten asm like "MOVD R5, foosymbol" where a base register is not supplied,
// or "MOVD R5, foo+10(SP) or pseudo-register is used. The other common case is when
// generating constants in register like "MOVD $constant, Rx".
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/obj/riscv/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ func instructionForProg(p *obj.Prog) *instruction {
return ins
}

// instructionsForOpImmediate returns the machine instructions for a immedate
// instructionsForOpImmediate returns the machine instructions for an immediate
// operand. The instruction is specified by as and the source register is
// specified by rs, instead of the obj.Prog.
func instructionsForOpImmediate(p *obj.Prog, as obj.As, rs int16) []*instruction {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/obj/wasm/wasmobj.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {

// Offset is the location of the param on the Go stack (ie relative to sp).
// Because of our call convention, the parameters are located an additional 8 bytes
// from sp because we store the return address as a int64 at the bottom of the stack.
// from sp because we store the return address as an int64 at the bottom of the stack.
// Ie the stack looks like [return_addr, param3, param2, param1, etc]

// Ergo, we add 8 to the true byte offset of the param to skip the return address.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/link/internal/ld/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ func (ctxt *Link) dodata(symGroupType []sym.SymKind) {
}
}

// allocateDataSectionForSym creates a new sym.Section into which a a
// allocateDataSectionForSym creates a new sym.Section into which a
// single symbol will be placed. Here "seg" is the segment into which
// the section will go, "s" is the symbol to be placed into the new
// section, and "rwx" contains permissions for the section.
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/link/internal/ld/xcoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
// XCOFF binaries should normally have all its sections position-independent.
// However, this is not yet possible for .text because of some R_ADDR relocations
// inside RODATA symbols.
// .data and .bss are position-independent so their address start inside a unreachable
// .data and .bss are position-independent so their address start inside an unreachable
// segment during execution to force segfault if something is wrong.
XCOFFTEXTBASE = 0x100000000 // Start of text address
XCOFFDATABASE = 0x200000000 // Start of data address
Expand Down Expand Up @@ -875,7 +875,7 @@ func (f *xcoffFile) writeSymbolFunc(ctxt *Link, x loader.Sym) []xcoffSym {
// put function used by genasmsym to write symbol table.
func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) {
// All XCOFF symbols generated by this GO symbols
// Can be a symbol entry or a auxiliary entry
// Can be a symbol entry or an auxiliary entry
syms := []xcoffSym{}

ldr := ctxt.loader
Expand Down Expand Up @@ -1329,7 +1329,7 @@ func (ctxt *Link) doxcoff() {
}

if ldr.SymType(s) == sym.STEXT {
// On AIX, a exported function must have two symbols:
// On AIX, an exported function must have two symbols:
// - a .text symbol which must start with a ".".
// - a .data symbol which is a function descriptor.
name := ldr.SymExtname(s)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/link/internal/loadpe/ldpe.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const (
// a jump to the loaded value.
CreateImportStubPltToken = -2

// When stored into the GOT value for a import symbol __imp_X this
// When stored into the GOT value for an import symbol __imp_X this
// token tells windynrelocsym to redirect references to the
// underlying DYNIMPORT symbol X.
RedirectToDynImportGotToken = -2
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/link/internal/ppc64/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ func xcoffreloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sy
}

func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, ri int, sectoff int64) bool {
// Beware that bit0~bit15 start from the third byte of a instruction in Big-Endian machines.
// Beware that bit0~bit15 start from the third byte of an instruction in Big-Endian machines.
rt := r.Type
if rt == objabi.R_ADDR || rt == objabi.R_POWER_TLS || rt == objabi.R_CALLPOWER {
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/internal/edwards25519/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *Scalar) Set(x *Scalar) *Scalar {
// If x is not of the right length, SetUniformBytes returns nil and an error,
// and the receiver is unchanged.
//
// SetUniformBytes can be used to set s to an uniformly distributed value given
// SetUniformBytes can be used to set s to a uniformly distributed value given
// 64 uniformly distributed random bytes.
func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error) {
if len(x) != 64 {
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/tls/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type cacheEntry struct {
// multiple Conns. Returned references should not be mutated by callers. Certificates
// are still safe to use after they are removed from the cache.
//
// Certificates are returned wrapped in a activeCert struct that should be held by
// Certificates are returned wrapped in an activeCert struct that should be held by
// the caller. When references to the activeCert are freed, the number of references
// to the certificate in the cache is decremented. Once the number of references
// reaches zero, the entry is evicted from the cache.
Expand All @@ -49,7 +49,7 @@ type activeCert struct {
}

// active increments the number of references to the entry, wraps the
// certificate in the entry in a activeCert, and sets the finalizer.
// certificate in the entry in an activeCert, and sets the finalizer.
//
// Note that there is a race between active and the finalizer set on the
// returned activeCert, triggered if active is called after the ref count is
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/x509/pkcs8.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type pkcs8 struct {

// ParsePKCS8PrivateKey parses an unencrypted private key in PKCS #8, ASN.1 DER form.
//
// It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not
// a pointer), or a *ecdh.PrivateKey (for X25519). More types might be supported
// It returns a *rsa.PrivateKey, an *ecdsa.PrivateKey, an ed25519.PrivateKey (not
// a pointer), or an *ecdh.PrivateKey (for X25519). More types might be supported
// in the future.
//
// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY".
Expand Down
4 changes: 2 additions & 2 deletions src/debug/pe/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func (e *FormatError) Error() string {
return "unknown error"
}

// readOptionalHeader accepts a io.ReadSeeker pointing to optional header in the PE file
// readOptionalHeader accepts an io.ReadSeeker pointing to optional header in the PE file
// and its size as seen in the file header.
// It parses the given size of bytes and returns optional header. It infers whether the
// bytes being parsed refer to 32 bit or 64 bit version of optional header.
Expand Down Expand Up @@ -612,7 +612,7 @@ func readOptionalHeader(r io.ReadSeeker, sz uint16) (any, error) {
}
}

// readDataDirectories accepts a io.ReadSeeker pointing to data directories in the PE file,
// readDataDirectories accepts an io.ReadSeeker pointing to data directories in the PE file,
// its size and number of data directories as seen in optional header.
// It parses the given size of bytes and returns given number of data directories.
func readDataDirectories(r io.ReadSeeker, sz uint16, n uint32) ([]DataDirectory, error) {
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/gob/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (enc *Encoder) setError(err error) {
}
}

// writeMessage sends the data item preceded by a unsigned count of its length.
// writeMessage sends the data item preceded by an unsigned count of its length.
func (enc *Encoder) writeMessage(w io.Writer, b *encBuffer) {
// Space has been reserved for the length at the head of the message.
// This is a little dirty: we grab the slice from the bytes.Buffer and massage
Expand Down
2 changes: 1 addition & 1 deletion src/go/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ parseElements:
}

// TODO(rfindley): the error produced here could be improved, since we could
// accept a identifier, 'type', or a '}' at this point.
// accept an identifier, 'type', or a '}' at this point.
rbrace := p.expect(token.RBRACE)

return &ast.InterfaceType{
Expand Down
2 changes: 1 addition & 1 deletion src/index/suffixarray/sais.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func induceSubS_8_32(text []byte, sa, freq, bucket []int32) {
// Second, to avoid text comparison entirely, if an LMS-substring is very short,
// sa[j/2] records its actual text instead of its length, so that if two such
// substrings have matching “length,” the text need not be read at all.
// The definition of “very short” is that the text bytes must pack into an uint32,
// The definition of “very short” is that the text bytes must pack into a uint32,
// and the unsigned encoding e must be ≥ len(text), so that it can be
// distinguished from a valid length.
func length_8_32(text []byte, sa []int32, numLMS int) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/xcoff/ar.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func NewArchive(r io.ReaderAt) (*Archive, error) {

// GetFile returns the XCOFF file defined by member name.
// FIXME: This doesn't work if an archive has two members with the same
// name which can occur if a archive has both 32-bits and 64-bits files.
// name which can occur if an archive has both 32-bits and 64-bits files.
func (arch *Archive) GetFile(name string) (*File, error) {
for _, mem := range arch.Members {
if mem.Name == name {
Expand Down
2 changes: 1 addition & 1 deletion src/math/rand/rng.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (rng *rngSource) Int63() int64 {
return int64(rng.Uint64() & rngMask)
}

// Uint64 returns a non-negative pseudo-random 64-bit integer as an uint64.
// Uint64 returns a non-negative pseudo-random 64-bit integer as a uint64.
func (rng *rngSource) Uint64() uint64 {
rng.tap--
if rng.tap < 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/net/error_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// wrapSyscallError takes an error and a syscall name. If the error is
// a syscall.Errno, it wraps it in a os.SyscallError using the syscall name.
// a syscall.Errno, it wraps it in an os.SyscallError using the syscall name.
func wrapSyscallError(name string, err error) error {
if _, ok := err.(syscall.Errno); ok {
err = os.NewSyscallError(name, err)
Expand Down
4 changes: 2 additions & 2 deletions src/net/http/cookiejar/jar.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func isIP(host string) bool {
return net.ParseIP(host) != nil
}

// defaultPath returns the directory part of an URL's path according to
// defaultPath returns the directory part of a URL's path according to
// RFC 6265 section 5.1.4.
func defaultPath(path string) string {
if len(path) == 0 || path[0] != '/' {
Expand All @@ -379,7 +379,7 @@ func defaultPath(path string) string {
return path[:i] // Path is either of form "/abc/xyz" or "/abc/xyz/".
}

// newEntry creates an entry from a http.Cookie c. now is the current time and
// newEntry creates an entry from an http.Cookie c. now is the current time and
// is compared to c.Expires to determine deletion of c. defPath and host are the
// default-path and the canonical host name of the URL c was received from.
//
Expand Down
2 changes: 1 addition & 1 deletion src/reflect/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -3474,7 +3474,7 @@ func convertOp(dst, src *rtype) func(Value, Type) Value {
if dst.Kind() == Pointer && dst.Elem().Kind() == Array && src.Elem() == dst.Elem().Elem() {
return cvtSliceArrayPtr
}
// "x is a slice, T is a array type,
// "x is a slice, T is an array type,
// and the slice and array types have identical element types."
if dst.Kind() == Array && src.Elem() == dst.Elem() {
return cvtSliceArray
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func panicdottypeI(have *itab, want, iface *_type) {
panicdottypeE(t, want, iface)
}

// panicnildottype is called when doing a i.(T) conversion and the interface i is nil.
// panicnildottype is called when doing an i.(T) conversion and the interface i is nil.
// want = the static type we're trying to convert to.
func panicnildottype(want *_type) {
panic(&TypeAssertionError{nil, nil, want, ""})
Expand Down
4 changes: 2 additions & 2 deletions src/syscall/js/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (e *ValueError) Error() string {
}

// CopyBytesToGo copies bytes from src to dst.
// It panics if src is not an Uint8Array or Uint8ClampedArray.
// It panics if src is not a Uint8Array or Uint8ClampedArray.
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
func CopyBytesToGo(dst []byte, src Value) int {
n, ok := copyBytesToGo(dst, src.ref)
Expand All @@ -585,7 +585,7 @@ func CopyBytesToGo(dst []byte, src Value) int {
func copyBytesToGo(dst []byte, src ref) (int, bool)

// CopyBytesToJS copies bytes from src to dst.
// It panics if dst is not an Uint8Array or Uint8ClampedArray.
// It panics if dst is not a Uint8Array or Uint8ClampedArray.
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
func CopyBytesToJS(dst Value, src []byte) int {
n, ok := copyBytesToJS(dst.ref, src)
Expand Down

0 comments on commit d8d2266

Please sign in to comment.