mirror of
https://github.com/golang/go
synced 2024-11-25 09:57:57 -07:00
all: be more idiomatic when documenting boolean return values.
Phrases like "returns whether or not the image is opaque" could be describing what the function does (it always returns, regardless of the opacity) or what it returns (a boolean indicating the opacity). Even when the "or not" is missing, the phrasing is bizarre. Go with "reports whether", which is still clunky but at least makes it clear we're talking about the return value. These were edited by hand. A few were cleaned up in other ways. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/11699043
This commit is contained in:
parent
7d9a8fb8a9
commit
abe384f68a
@ -28,7 +28,7 @@ func (f *Field) Set(x, y int, b bool) {
|
|||||||
f.s[y][x] = b
|
f.s[y][x] = b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alive returns whether the specified cell is alive.
|
// Alive reports whether the specified cell is alive.
|
||||||
// If the x or y coordinates are outside the field boundaries they are wrapped
|
// If the x or y coordinates are outside the field boundaries they are wrapped
|
||||||
// toroidally. For instance, an x value of -1 is treated as width-1.
|
// toroidally. For instance, an x value of -1 is treated as width-1.
|
||||||
func (f *Field) Alive(x, y int) bool {
|
func (f *Field) Alive(x, y int) bool {
|
||||||
|
2
src/cmd/dist/plan9.c
vendored
2
src/cmd/dist/plan9.c
vendored
@ -736,7 +736,7 @@ xstrrchr(char *p, int c)
|
|||||||
return strrchr(p, c);
|
return strrchr(p, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// xsamefile returns whether f1 and f2 are the same file (or dir)
|
// xsamefile reports whether f1 and f2 are the same file (or dir)
|
||||||
int
|
int
|
||||||
xsamefile(char *f1, char *f2)
|
xsamefile(char *f1, char *f2)
|
||||||
{
|
{
|
||||||
|
2
src/cmd/dist/unix.c
vendored
2
src/cmd/dist/unix.c
vendored
@ -747,7 +747,7 @@ xstrrchr(char *p, int c)
|
|||||||
return strrchr(p, c);
|
return strrchr(p, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// xsamefile returns whether f1 and f2 are the same file (or dir)
|
// xsamefile reports whether f1 and f2 are the same file (or dir)
|
||||||
int
|
int
|
||||||
xsamefile(char *f1, char *f2)
|
xsamefile(char *f1, char *f2)
|
||||||
{
|
{
|
||||||
|
2
src/cmd/dist/windows.c
vendored
2
src/cmd/dist/windows.c
vendored
@ -929,7 +929,7 @@ xstrrchr(char *p, int c)
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// xsamefile returns whether f1 and f2 are the same file (or dir)
|
// xsamefile reports whether f1 and f2 are the same file (or dir)
|
||||||
int
|
int
|
||||||
xsamefile(char *f1, char *f2)
|
xsamefile(char *f1, char *f2)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ initname(char *s)
|
|||||||
return strcmp(s, "init") == 0;
|
return strcmp(s, "init") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// exportedsym returns whether a symbol will be visible
|
// exportedsym reports whether a symbol will be visible
|
||||||
// to files that import our package.
|
// to files that import our package.
|
||||||
static int
|
static int
|
||||||
exportedsym(Sym *sym)
|
exportedsym(Sym *sym)
|
||||||
|
@ -525,7 +525,7 @@ saveorignode(Node *n)
|
|||||||
n->orig = norig;
|
n->orig = norig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ispaddedfield returns whether the given field
|
// ispaddedfield reports whether the given field
|
||||||
// is followed by padding. For the case where t is
|
// is followed by padding. For the case where t is
|
||||||
// the last field, total gives the size of the enclosing struct.
|
// the last field, total gives the size of the enclosing struct.
|
||||||
static int
|
static int
|
||||||
|
@ -492,12 +492,12 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
|
|||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// usesSwig returns whether the package needs to run SWIG.
|
// usesSwig reports whether the package needs to run SWIG.
|
||||||
func (p *Package) usesSwig() bool {
|
func (p *Package) usesSwig() bool {
|
||||||
return len(p.SwigFiles) > 0 || len(p.SwigCXXFiles) > 0
|
return len(p.SwigFiles) > 0 || len(p.SwigCXXFiles) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// usesCgo returns whether the package needs to run cgo
|
// usesCgo reports whether the package needs to run cgo
|
||||||
func (p *Package) usesCgo() bool {
|
func (p *Package) usesCgo() bool {
|
||||||
return len(p.CgoFiles) > 0
|
return len(p.CgoFiles) > 0
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
|||||||
return 0, nil, nil
|
return 0, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSpace returns whether the character is a Unicode white space character.
|
// isSpace reports whether the character is a Unicode white space character.
|
||||||
// We avoid dependency on the unicode package, but check validity of the implementation
|
// We avoid dependency on the unicode package, but check validity of the implementation
|
||||||
// in the tests.
|
// in the tests.
|
||||||
func isSpace(r rune) bool {
|
func isSpace(r rune) bool {
|
||||||
|
@ -77,7 +77,7 @@ func Count(s, sep []byte) int {
|
|||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contains returns whether subslice is within b.
|
// Contains reports whether subslice is within b.
|
||||||
func Contains(b, subslice []byte) bool {
|
func Contains(b, subslice []byte) bool {
|
||||||
return Index(b, subslice) != -1
|
return Index(b, subslice) != -1
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,8 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify verifies the signature in r, s of hash using the public key, pub. It
|
// Verify verifies the signature in r, s of hash using the public key, pub. Its
|
||||||
// returns whether the signature is valid.
|
// return value records whether the signature is valid.
|
||||||
func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool {
|
func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool {
|
||||||
// See [NSA] 3.4.2
|
// See [NSA] 3.4.2
|
||||||
c := pub.Curve
|
c := pub.Curve
|
||||||
|
@ -144,7 +144,7 @@ type CertificateList struct {
|
|||||||
SignatureValue asn1.BitString
|
SignatureValue asn1.BitString
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasExpired returns whether now is past the expiry time of certList.
|
// HasExpired reports whether now is past the expiry time of certList.
|
||||||
func (certList *CertificateList) HasExpired(now time.Time) bool {
|
func (certList *CertificateList) HasExpired(now time.Time) bool {
|
||||||
return now.After(certList.TBSCertList.NextUpdate)
|
return now.After(certList.TBSCertList.NextUpdate)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ type Sym struct {
|
|||||||
Func *Func
|
Func *Func
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static returns whether this symbol is static (not visible outside its file).
|
// Static reports whether this symbol is static (not visible outside its file).
|
||||||
func (s *Sym) Static() bool { return s.Type >= 'a' }
|
func (s *Sym) Static() bool { return s.Type >= 'a' }
|
||||||
|
|
||||||
// PackageName returns the package part of the symbol name,
|
// PackageName returns the package part of the symbol name,
|
||||||
|
@ -183,7 +183,7 @@ func parseBitString(bytes []byte) (ret BitString, err error) {
|
|||||||
// An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER.
|
// An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER.
|
||||||
type ObjectIdentifier []int
|
type ObjectIdentifier []int
|
||||||
|
|
||||||
// Equal returns whether oi and other represent the same identifier.
|
// Equal reports whether oi and other represent the same identifier.
|
||||||
func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool {
|
func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool {
|
||||||
if len(oi) != len(other) {
|
if len(oi) != len(other) {
|
||||||
return false
|
return false
|
||||||
|
@ -474,7 +474,7 @@ func (enc *Encoder) encodeInterface(b *bytes.Buffer, iv reflect.Value) {
|
|||||||
enc.freeEncoderState(state)
|
enc.freeEncoderState(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isZero returns whether the value is the zero of its type.
|
// isZero reports whether the value is the zero of its type.
|
||||||
func isZero(val reflect.Value) bool {
|
func isZero(val reflect.Value) bool {
|
||||||
switch val.Kind() {
|
switch val.Kind() {
|
||||||
case reflect.Array:
|
case reflect.Array:
|
||||||
|
@ -21,7 +21,7 @@ func parseTag(tag string) (string, tagOptions) {
|
|||||||
return tag, tagOptions("")
|
return tag, tagOptions("")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contains returns whether checks that a comma-separated list of options
|
// Contains reports whether a comma-separated list of options
|
||||||
// contains a particular substr flag. substr must be surrounded by a
|
// contains a particular substr flag. substr must be surrounded by a
|
||||||
// string boundary or commas.
|
// string boundary or commas.
|
||||||
func (o tagOptions) Contains(optionName string) bool {
|
func (o tagOptions) Contains(optionName string) bool {
|
||||||
|
@ -699,7 +699,7 @@ func (f *FlagSet) usage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseOne parses one flag. It returns whether a flag was seen.
|
// parseOne parses one flag. It reports whether a flag was seen.
|
||||||
func (f *FlagSet) parseOne() (bool, error) {
|
func (f *FlagSet) parseOne() (bool, error) {
|
||||||
if len(f.args) == 0 {
|
if len(f.args) == 0 {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
@ -43,7 +43,7 @@ type State interface {
|
|||||||
// Precision returns the value of the precision option and whether it has been set.
|
// Precision returns the value of the precision option and whether it has been set.
|
||||||
Precision() (prec int, ok bool)
|
Precision() (prec int, ok bool)
|
||||||
|
|
||||||
// Flag returns whether the flag c, a character, has been set.
|
// Flag reports whether the flag c, a character, has been set.
|
||||||
Flag(c int) bool
|
Flag(c int) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,15 +519,15 @@ func (*ChanType) exprNode() {}
|
|||||||
//
|
//
|
||||||
func NewIdent(name string) *Ident { return &Ident{token.NoPos, name, nil} }
|
func NewIdent(name string) *Ident { return &Ident{token.NoPos, name, nil} }
|
||||||
|
|
||||||
// IsExported returns whether name is an exported Go symbol
|
// IsExported reports whether name is an exported Go symbol
|
||||||
// (i.e., whether it begins with an uppercase letter).
|
// (that is, whether it begins with an upper-case letter).
|
||||||
//
|
//
|
||||||
func IsExported(name string) bool {
|
func IsExported(name string) bool {
|
||||||
ch, _ := utf8.DecodeRuneInString(name)
|
ch, _ := utf8.DecodeRuneInString(name)
|
||||||
return unicode.IsUpper(ch)
|
return unicode.IsUpper(ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsExported returns whether id is an exported Go symbol
|
// IsExported reports whether id is an exported Go symbol
|
||||||
// (i.e., whether it begins with an uppercase letter).
|
// (i.e., whether it begins with an uppercase letter).
|
||||||
//
|
//
|
||||||
func (id *Ident) IsExported() bool { return IsExported(id.Name) }
|
func (id *Ident) IsExported() bool { return IsExported(id.Name) }
|
||||||
|
4
src/pkg/go/doc/testdata/testing.0.golden
vendored
4
src/pkg/go/doc/testdata/testing.0.golden
vendored
@ -57,7 +57,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *B) FailNow()
|
func (c *B) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *B) Failed() bool
|
func (c *B) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
@ -136,7 +136,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *T) FailNow()
|
func (c *T) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *T) Failed() bool
|
func (c *T) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
|
6
src/pkg/go/doc/testdata/testing.1.golden
vendored
6
src/pkg/go/doc/testdata/testing.1.golden
vendored
@ -130,7 +130,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *B) FailNow()
|
func (c *B) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *B) Failed() bool
|
func (c *B) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
@ -232,7 +232,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *T) FailNow()
|
func (c *T) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *T) Failed() bool
|
func (c *T) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
@ -278,7 +278,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *common) FailNow()
|
func (c *common) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *common) Failed() bool
|
func (c *common) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
|
4
src/pkg/go/doc/testdata/testing.2.golden
vendored
4
src/pkg/go/doc/testdata/testing.2.golden
vendored
@ -57,7 +57,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *B) FailNow()
|
func (c *B) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *B) Failed() bool
|
func (c *B) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
@ -136,7 +136,7 @@ TYPES
|
|||||||
// FailNow marks the function as having failed and stops its ...
|
// FailNow marks the function as having failed and stops its ...
|
||||||
func (c *T) FailNow()
|
func (c *T) FailNow()
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *T) Failed() bool
|
func (c *T) Failed() bool
|
||||||
|
|
||||||
// Fatal is equivalent to Log() followed by FailNow().
|
// Fatal is equivalent to Log() followed by FailNow().
|
||||||
|
2
src/pkg/go/doc/testdata/testing.go
vendored
2
src/pkg/go/doc/testdata/testing.go
vendored
@ -130,7 +130,7 @@ type T struct {
|
|||||||
// Fail marks the function as having failed but continues execution.
|
// Fail marks the function as having failed but continues execution.
|
||||||
func (c *common) Fail() { c.failed = true }
|
func (c *common) Fail() { c.failed = true }
|
||||||
|
|
||||||
// Failed returns whether the function has failed.
|
// Failed reports whether the function has failed.
|
||||||
func (c *common) Failed() bool { return c.failed }
|
func (c *common) Failed() bool { return c.failed }
|
||||||
|
|
||||||
// FailNow marks the function as having failed and stops its execution.
|
// FailNow marks the function as having failed and stops its execution.
|
||||||
|
@ -29,7 +29,7 @@ func (c context) String() string {
|
|||||||
return fmt.Sprintf("{%v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.attr, c.element, c.err)
|
return fmt.Sprintf("{%v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.attr, c.element, c.err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// eq returns whether two contexts are equal.
|
// eq reports whether two contexts are equal.
|
||||||
func (c context) eq(d context) bool {
|
func (c context) eq(d context) bool {
|
||||||
return c.state == d.state &&
|
return c.state == d.state &&
|
||||||
c.delim == d.delim &&
|
c.delim == d.delim &&
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
// endsWithCSSKeyword returns whether b ends with an ident that
|
// endsWithCSSKeyword reports whether b ends with an ident that
|
||||||
// case-insensitively matches the lower-case kw.
|
// case-insensitively matches the lower-case kw.
|
||||||
func endsWithCSSKeyword(b []byte, kw string) bool {
|
func endsWithCSSKeyword(b []byte, kw string) bool {
|
||||||
i := len(b) - len(kw)
|
i := len(b) - len(kw)
|
||||||
@ -34,7 +34,7 @@ func endsWithCSSKeyword(b []byte, kw string) bool {
|
|||||||
return string(bytes.ToLower(b[i:])) == kw
|
return string(bytes.ToLower(b[i:])) == kw
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCSSNmchar returns whether rune is allowed anywhere in a CSS identifier.
|
// isCSSNmchar reports whether rune is allowed anywhere in a CSS identifier.
|
||||||
func isCSSNmchar(r rune) bool {
|
func isCSSNmchar(r rune) bool {
|
||||||
// Based on the CSS3 nmchar production but ignores multi-rune escape
|
// Based on the CSS3 nmchar production but ignores multi-rune escape
|
||||||
// sequences.
|
// sequences.
|
||||||
@ -99,7 +99,7 @@ func decodeCSS(s []byte) []byte {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// isHex returns whether the given character is a hex digit.
|
// isHex reports reports whether the given character is a hex digit.
|
||||||
func isHex(c byte) bool {
|
func isHex(c byte) bool {
|
||||||
return '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'
|
return '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ func skipCSSSpace(c []byte) []byte {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCSSSpace returns whether b is a CSS space char as defined in wc.
|
// isCSSSpace reports whether b is a CSS space char as defined in wc.
|
||||||
func isCSSSpace(b byte) bool {
|
func isCSSSpace(b byte) bool {
|
||||||
switch b {
|
switch b {
|
||||||
case '\t', '\n', '\f', '\r', ' ':
|
case '\t', '\n', '\f', '\r', ' ':
|
||||||
|
@ -301,7 +301,7 @@ func indexOfStr(s string, strs []string, eq func(a, b string) bool) int {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// escFnsEq returns whether the two escaping functions are equivalent.
|
// escFnsEq reports whether the two escaping functions are equivalent.
|
||||||
func escFnsEq(a, b string) bool {
|
func escFnsEq(a, b string) bool {
|
||||||
if e := equivEscapers[a]; e != "" {
|
if e := equivEscapers[a]; e != "" {
|
||||||
a = e
|
a = e
|
||||||
|
@ -341,7 +341,7 @@ var jsRegexpReplacementTable = []string{
|
|||||||
'}': `\}`,
|
'}': `\}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// isJSIdentPart returns whether the given rune is a JS identifier part.
|
// isJSIdentPart reports whether the given rune is a JS identifier part.
|
||||||
// It does not handle all the non-Latin letters, joiners, and combining marks,
|
// It does not handle all the non-Latin letters, joiners, and combining marks,
|
||||||
// but it does handle every codepoint that can occur in a numeric literal or
|
// but it does handle every codepoint that can occur in a numeric literal or
|
||||||
// a keyword.
|
// a keyword.
|
||||||
|
@ -504,12 +504,12 @@ var elementNameMap = map[string]element{
|
|||||||
"title": elementTitle,
|
"title": elementTitle,
|
||||||
}
|
}
|
||||||
|
|
||||||
// asciiAlpha returns whether c is an ASCII letter.
|
// asciiAlpha reports whether c is an ASCII letter.
|
||||||
func asciiAlpha(c byte) bool {
|
func asciiAlpha(c byte) bool {
|
||||||
return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
|
return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
|
||||||
}
|
}
|
||||||
|
|
||||||
// asciiAlphaNum returns whether c is an ASCII letter or digit.
|
// asciiAlphaNum reports whether c is an ASCII letter or digit.
|
||||||
func asciiAlphaNum(c byte) bool {
|
func asciiAlphaNum(c byte) bool {
|
||||||
return asciiAlpha(c) || '0' <= c && c <= '9'
|
return asciiAlpha(c) || '0' <= c && c <= '9'
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func asReader(r io.Reader) reader {
|
|||||||
return bufio.NewReader(r)
|
return bufio.NewReader(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match returns whether magic matches b. Magic may contain "?" wildcards.
|
// Match reports whether magic matches b. Magic may contain "?" wildcards.
|
||||||
func match(magic string, b []byte) bool {
|
func match(magic string, b []byte) bool {
|
||||||
if len(magic) != len(b) {
|
if len(magic) != len(b) {
|
||||||
return false
|
return false
|
||||||
|
@ -38,7 +38,7 @@ func (p Point) Div(k int) Point {
|
|||||||
return Point{p.X / k, p.Y / k}
|
return Point{p.X / k, p.Y / k}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In returns whether p is in r.
|
// In reports whether p is in r.
|
||||||
func (p Point) In(r Rectangle) bool {
|
func (p Point) In(r Rectangle) bool {
|
||||||
return r.Min.X <= p.X && p.X < r.Max.X &&
|
return r.Min.X <= p.X && p.X < r.Max.X &&
|
||||||
r.Min.Y <= p.Y && p.Y < r.Max.Y
|
r.Min.Y <= p.Y && p.Y < r.Max.Y
|
||||||
@ -60,7 +60,7 @@ func (p Point) Mod(r Rectangle) Point {
|
|||||||
return p.Add(r.Min)
|
return p.Add(r.Min)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eq returns whether p and q are equal.
|
// Eq reports whether p and q are equal.
|
||||||
func (p Point) Eq(q Point) bool {
|
func (p Point) Eq(q Point) bool {
|
||||||
return p.X == q.X && p.Y == q.Y
|
return p.X == q.X && p.Y == q.Y
|
||||||
}
|
}
|
||||||
@ -179,24 +179,24 @@ func (r Rectangle) Union(s Rectangle) Rectangle {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty returns whether the rectangle contains no points.
|
// Empty reports whether the rectangle contains no points.
|
||||||
func (r Rectangle) Empty() bool {
|
func (r Rectangle) Empty() bool {
|
||||||
return r.Min.X >= r.Max.X || r.Min.Y >= r.Max.Y
|
return r.Min.X >= r.Max.X || r.Min.Y >= r.Max.Y
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eq returns whether r and s are equal.
|
// Eq reports whether r and s are equal.
|
||||||
func (r Rectangle) Eq(s Rectangle) bool {
|
func (r Rectangle) Eq(s Rectangle) bool {
|
||||||
return r.Min.X == s.Min.X && r.Min.Y == s.Min.Y &&
|
return r.Min.X == s.Min.X && r.Min.Y == s.Min.Y &&
|
||||||
r.Max.X == s.Max.X && r.Max.Y == s.Max.Y
|
r.Max.X == s.Max.X && r.Max.Y == s.Max.Y
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlaps returns whether r and s have a non-empty intersection.
|
// Overlaps reports whether r and s have a non-empty intersection.
|
||||||
func (r Rectangle) Overlaps(s Rectangle) bool {
|
func (r Rectangle) Overlaps(s Rectangle) bool {
|
||||||
return r.Min.X < s.Max.X && s.Min.X < r.Max.X &&
|
return r.Min.X < s.Max.X && s.Min.X < r.Max.X &&
|
||||||
r.Min.Y < s.Max.Y && s.Min.Y < r.Max.Y
|
r.Min.Y < s.Max.Y && s.Min.Y < r.Max.Y
|
||||||
}
|
}
|
||||||
|
|
||||||
// In returns whether every point in r is in s.
|
// In reports whether every point in r is in s.
|
||||||
func (r Rectangle) In(s Rectangle) bool {
|
func (r Rectangle) In(s Rectangle) bool {
|
||||||
if r.Empty() {
|
if r.Empty() {
|
||||||
return true
|
return true
|
||||||
|
@ -126,7 +126,7 @@ func (p *RGBA) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *RGBA) Opaque() bool {
|
func (p *RGBA) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -234,7 +234,7 @@ func (p *RGBA64) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *RGBA64) Opaque() bool {
|
func (p *RGBA64) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -329,7 +329,7 @@ func (p *NRGBA) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *NRGBA) Opaque() bool {
|
func (p *NRGBA) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -437,7 +437,7 @@ func (p *NRGBA64) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *NRGBA64) Opaque() bool {
|
func (p *NRGBA64) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -525,7 +525,7 @@ func (p *Alpha) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *Alpha) Opaque() bool {
|
func (p *Alpha) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -616,7 +616,7 @@ func (p *Alpha16) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *Alpha16) Opaque() bool {
|
func (p *Alpha16) Opaque() bool {
|
||||||
if p.Rect.Empty() {
|
if p.Rect.Empty() {
|
||||||
return true
|
return true
|
||||||
@ -704,7 +704,7 @@ func (p *Gray) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *Gray) Opaque() bool {
|
func (p *Gray) Opaque() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ func (p *Gray16) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *Gray16) Opaque() bool {
|
func (p *Gray16) Opaque() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -873,7 +873,7 @@ func (p *Paletted) SubImage(r Rectangle) Image {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (p *Paletted) Opaque() bool {
|
func (p *Paletted) Opaque() bool {
|
||||||
var present [256]bool
|
var present [256]bool
|
||||||
i0, i1 := 0, p.Rect.Dx()
|
i0, i1 := 0, p.Rect.Dx()
|
||||||
|
@ -90,7 +90,7 @@ func TestDCT(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// differ returns whether any pair-wise elements in b0 and b1 differ by 2 or
|
// differ reports whether any pair-wise elements in b0 and b1 differ by 2 or
|
||||||
// more. That tolerance is because there isn't a single definitive decoding of
|
// more. That tolerance is because there isn't a single definitive decoding of
|
||||||
// a given JPEG image, even before the YCbCr to RGB conversion; implementations
|
// a given JPEG image, even before the YCbCr to RGB conversion; implementations
|
||||||
// can have different IDCT rounding errors.
|
// can have different IDCT rounding errors.
|
||||||
|
@ -41,7 +41,7 @@ func (c *Uniform) Bounds() Rectangle { return Rectangle{Point{-1e9, -1e9}, Point
|
|||||||
|
|
||||||
func (c *Uniform) At(x, y int) color.Color { return c.C }
|
func (c *Uniform) At(x, y int) color.Color { return c.C }
|
||||||
|
|
||||||
// Opaque scans the entire image and returns whether or not it is fully opaque.
|
// Opaque scans the entire image and reports whether it is fully opaque.
|
||||||
func (c *Uniform) Opaque() bool {
|
func (c *Uniform) Opaque() bool {
|
||||||
_, _, _, a := c.C.RGBA()
|
_, _, _, a := c.C.RGBA()
|
||||||
return a == 0xffff
|
return a == 0xffff
|
||||||
|
@ -27,7 +27,7 @@ func Inf(sign int) float64 {
|
|||||||
// NaN returns an IEEE 754 ``not-a-number'' value.
|
// NaN returns an IEEE 754 ``not-a-number'' value.
|
||||||
func NaN() float64 { return Float64frombits(uvnan) }
|
func NaN() float64 { return Float64frombits(uvnan) }
|
||||||
|
|
||||||
// IsNaN returns whether f is an IEEE 754 ``not-a-number'' value.
|
// IsNaN reports whether f is an IEEE 754 ``not-a-number'' value.
|
||||||
func IsNaN(f float64) (is bool) {
|
func IsNaN(f float64) (is bool) {
|
||||||
// IEEE 754 says that only NaNs satisfy f != f.
|
// IEEE 754 says that only NaNs satisfy f != f.
|
||||||
// To avoid the floating-point hardware, could use:
|
// To avoid the floating-point hardware, could use:
|
||||||
@ -36,10 +36,10 @@ func IsNaN(f float64) (is bool) {
|
|||||||
return f != f
|
return f != f
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsInf returns whether f is an infinity, according to sign.
|
// IsInf reports whether f is an infinity, according to sign.
|
||||||
// If sign > 0, IsInf returns whether f is positive infinity.
|
// If sign > 0, IsInf reports whether f is positive infinity.
|
||||||
// If sign < 0, IsInf returns whether f is negative infinity.
|
// If sign < 0, IsInf reports whether f is negative infinity.
|
||||||
// If sign == 0, IsInf returns whether f is either infinity.
|
// If sign == 0, IsInf reports whether f is either infinity.
|
||||||
func IsInf(f float64, sign int) bool {
|
func IsInf(f float64, sign int) bool {
|
||||||
// Test for infinity by comparing against maximum float.
|
// Test for infinity by comparing against maximum float.
|
||||||
// To avoid the floating-point hardware, could use:
|
// To avoid the floating-point hardware, could use:
|
||||||
|
@ -272,7 +272,7 @@ func (r *Reader) NextPart() (*Part, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isFinalBoundary returns whether line is the final boundary line
|
// isFinalBoundary reports whether line is the final boundary line
|
||||||
// indicating that all parts are over.
|
// indicating that all parts are over.
|
||||||
// It matches `^--boundary--[ \t]*(\r\n)?$`
|
// It matches `^--boundary--[ \t]*(\r\n)?$`
|
||||||
func (mr *Reader) isFinalBoundary(line []byte) bool {
|
func (mr *Reader) isFinalBoundary(line []byte) bool {
|
||||||
@ -307,8 +307,8 @@ func (mr *Reader) isBoundaryDelimiterLine(line []byte) (ret bool) {
|
|||||||
return bytes.Equal(rest, mr.nl)
|
return bytes.Equal(rest, mr.nl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// peekBufferIsEmptyPart returns whether the provided peek-ahead
|
// peekBufferIsEmptyPart reports whether the provided peek-ahead
|
||||||
// buffer represents an empty part. This is only called if we've not
|
// buffer represents an empty part. It is called only if we've not
|
||||||
// already read any bytes in this part and checks for the case of MIME
|
// already read any bytes in this part and checks for the case of MIME
|
||||||
// software not writing the \r\n on empty parts. Some does, some
|
// software not writing the \r\n on empty parts. Some does, some
|
||||||
// doesn't.
|
// doesn't.
|
||||||
|
@ -142,7 +142,7 @@ func (e *entry) pathMatch(requestPath string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasDotSuffix returns whether s ends in "."+suffix.
|
// hasDotSuffix reports whether s ends in "."+suffix.
|
||||||
func hasDotSuffix(s, suffix string) bool {
|
func hasDotSuffix(s, suffix string) bool {
|
||||||
return len(s) > len(suffix) && s[len(s)-len(suffix)-1] == '.' && s[len(s)-len(suffix):] == suffix
|
return len(s) > len(suffix) && s[len(s)-len(suffix)-1] == '.' && s[len(s)-len(suffix):] == suffix
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ func canonicalHost(host string) (string, error) {
|
|||||||
return toASCII(host)
|
return toASCII(host)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasPort returns whether host contains a port number. host may be a host
|
// hasPort reports whether host contains a port number. host may be a host
|
||||||
// name, an IPv4 or an IPv6 address.
|
// name, an IPv4 or an IPv6 address.
|
||||||
func hasPort(host string) bool {
|
func hasPort(host string) bool {
|
||||||
colons := strings.Count(host, ":")
|
colons := strings.Count(host, ":")
|
||||||
@ -357,7 +357,7 @@ func jarKey(host string, psl PublicSuffixList) string {
|
|||||||
return host[prevDot+1:]
|
return host[prevDot+1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// isIP returns whether host is an IP address.
|
// isIP reports whether host is an IP address.
|
||||||
func isIP(host string) bool {
|
func isIP(host string) bool {
|
||||||
return net.ParseIP(host) != nil
|
return net.ParseIP(host) != nil
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ func defaultPath(path string) string {
|
|||||||
// is compared to c.Expires to determine deletion of c. defPath and host are the
|
// 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.
|
// default-path and the canonical host name of the URL c was received from.
|
||||||
//
|
//
|
||||||
// remove is whether the jar should delete this cookie, as it has already
|
// remove records whether the jar should delete this cookie, as it has already
|
||||||
// expired with respect to now. In this case, e may be incomplete, but it will
|
// expired with respect to now. In this case, e may be incomplete, but it will
|
||||||
// be valid to call e.id (which depends on e's Name, Domain and Path).
|
// be valid to call e.id (which depends on e's Name, Domain and Path).
|
||||||
//
|
//
|
||||||
|
@ -173,7 +173,7 @@ func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error {
|
|||||||
// canonical key for "accept-encoding" is "Accept-Encoding".
|
// canonical key for "accept-encoding" is "Accept-Encoding".
|
||||||
func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderKey(s) }
|
func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderKey(s) }
|
||||||
|
|
||||||
// hasToken returns whether token appears with v, ASCII
|
// hasToken reports whether token appears with v, ASCII
|
||||||
// case-insensitive, with space or comma boundaries.
|
// case-insensitive, with space or comma boundaries.
|
||||||
// token must be all lowercase.
|
// token must be all lowercase.
|
||||||
// v may contain mixed cased.
|
// v may contain mixed cased.
|
||||||
|
@ -183,7 +183,7 @@ type Request struct {
|
|||||||
TLS *tls.ConnectionState
|
TLS *tls.ConnectionState
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtoAtLeast returns whether the HTTP protocol used
|
// ProtoAtLeast reports whether the HTTP protocol used
|
||||||
// in the request is at least major.minor.
|
// in the request is at least major.minor.
|
||||||
func (r *Request) ProtoAtLeast(major, minor int) bool {
|
func (r *Request) ProtoAtLeast(major, minor int) bool {
|
||||||
return r.ProtoMajor > major ||
|
return r.ProtoMajor > major ||
|
||||||
|
@ -168,7 +168,7 @@ func fixPragmaCacheControl(header Header) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtoAtLeast returns whether the HTTP protocol used
|
// ProtoAtLeast reports whether the HTTP protocol used
|
||||||
// in the response is at least major.minor.
|
// in the response is at least major.minor.
|
||||||
func (r *Response) ProtoAtLeast(major, minor int) bool {
|
func (r *Response) ProtoAtLeast(major, minor int) bool {
|
||||||
return r.ProtoMajor > major ||
|
return r.ProtoMajor > major ||
|
||||||
|
@ -336,7 +336,7 @@ func (w *response) requestTooLarge() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// needsSniff returns whether a Content-Type still needs to be sniffed.
|
// needsSniff reports whether a Content-Type still needs to be sniffed.
|
||||||
func (w *response) needsSniff() bool {
|
func (w *response) needsSniff() bool {
|
||||||
return !w.cw.wroteHeader && w.handlerHeader.Get("Content-Type") == "" && w.written < sniffLen
|
return !w.cw.wroteHeader && w.handlerHeader.Get("Content-Type") == "" && w.written < sniffLen
|
||||||
}
|
}
|
||||||
@ -1044,7 +1044,7 @@ func (c *conn) closeWriteAndWait() {
|
|||||||
time.Sleep(rstAvoidanceDelay)
|
time.Sleep(rstAvoidanceDelay)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validNPN returns whether the proto is not a blacklisted Next
|
// validNPN reports whether the proto is not a blacklisted Next
|
||||||
// Protocol Negotiation protocol. Empty and built-in protocol types
|
// Protocol Negotiation protocol. Empty and built-in protocol types
|
||||||
// are blacklisted and can't be overridden with alternate
|
// are blacklisted and can't be overridden with alternate
|
||||||
// implementations.
|
// implementations.
|
||||||
|
@ -238,7 +238,7 @@ type transferReader struct {
|
|||||||
Trailer Header
|
Trailer Header
|
||||||
}
|
}
|
||||||
|
|
||||||
// bodyAllowedForStatus returns whether a given response status code
|
// bodyAllowedForStatus reports whether a given response status code
|
||||||
// permits a body. See RFC2616, section 4.4.
|
// permits a body. See RFC2616, section 4.4.
|
||||||
func bodyAllowedForStatus(status int) bool {
|
func bodyAllowedForStatus(status int) bool {
|
||||||
switch {
|
switch {
|
||||||
|
@ -58,7 +58,7 @@ func (p *ProcessState) SystemTime() time.Duration {
|
|||||||
return p.systemTime()
|
return p.systemTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exited returns whether the program has exited.
|
// Exited reports whether the program has exited.
|
||||||
func (p *ProcessState) Exited() bool {
|
func (p *ProcessState) Exited() bool {
|
||||||
return p.exited()
|
return p.exited()
|
||||||
}
|
}
|
||||||
|
@ -43,20 +43,23 @@ func NewSyscallError(syscall string, err error) error {
|
|||||||
return &SyscallError{syscall, err}
|
return &SyscallError{syscall, err}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsExist returns whether the error is known to report that a file or directory
|
// IsExist returns a boolean indicating whether the error is known to report
|
||||||
// already exists. It is satisfied by ErrExist as well as some syscall errors.
|
// that a file or directory already exists. It is satisfied by ErrExist as
|
||||||
|
// well as some syscall errors.
|
||||||
func IsExist(err error) bool {
|
func IsExist(err error) bool {
|
||||||
return isExist(err)
|
return isExist(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsNotExist returns whether the error is known to report that a file or directory
|
// IsNotExist returns a boolean indicating whether the error is known to
|
||||||
// does not exist. It is satisfied by ErrNotExist as well as some syscall errors.
|
// report that a file or directory does not exist. It is satisfied by
|
||||||
|
// ErrNotExist as well as some syscall errors.
|
||||||
func IsNotExist(err error) bool {
|
func IsNotExist(err error) bool {
|
||||||
return isNotExist(err)
|
return isNotExist(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPermission returns whether the error is known to report that permission is denied.
|
// IsPermission returns a boolean indicating whether the error is known to
|
||||||
// It is satisfied by ErrPermission as well as some syscall errors.
|
// report that permission is denied. It is satisfied by ErrPermission as well
|
||||||
|
// as some syscall errors.
|
||||||
func IsPermission(err error) bool {
|
func IsPermission(err error) bool {
|
||||||
return isPermission(err)
|
return isPermission(err)
|
||||||
}
|
}
|
||||||
|
@ -375,21 +375,18 @@ func (re *Regexp) LiteralPrefix() (prefix string, complete bool) {
|
|||||||
return re.prefix, re.prefixComplete
|
return re.prefix, re.prefixComplete
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchReader returns whether the Regexp matches the text read by the
|
// MatchReader reports whether the Regexp matches the text read by the
|
||||||
// RuneReader. The return value is a boolean: true for match, false for no
|
// RuneReader.
|
||||||
// match.
|
|
||||||
func (re *Regexp) MatchReader(r io.RuneReader) bool {
|
func (re *Regexp) MatchReader(r io.RuneReader) bool {
|
||||||
return re.doExecute(r, nil, "", 0, 0) != nil
|
return re.doExecute(r, nil, "", 0, 0) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchString returns whether the Regexp matches the string s.
|
// MatchString reports whether the Regexp matches the string s.
|
||||||
// The return value is a boolean: true for match, false for no match.
|
|
||||||
func (re *Regexp) MatchString(s string) bool {
|
func (re *Regexp) MatchString(s string) bool {
|
||||||
return re.doExecute(nil, nil, s, 0, 0) != nil
|
return re.doExecute(nil, nil, s, 0, 0) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match returns whether the Regexp matches the byte slice b.
|
// Match reports whether the Regexp matches the byte slice b.
|
||||||
// The return value is a boolean: true for match, false for no match.
|
|
||||||
func (re *Regexp) Match(b []byte) bool {
|
func (re *Regexp) Match(b []byte) bool {
|
||||||
return re.doExecute(nil, b, "", 0, 0) != nil
|
return re.doExecute(nil, b, "", 0, 0) != nil
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ package sort
|
|||||||
type Interface interface {
|
type Interface interface {
|
||||||
// Len is the number of elements in the collection.
|
// Len is the number of elements in the collection.
|
||||||
Len() int
|
Len() int
|
||||||
// Less returns whether the element with index i should sort
|
// Less reports whether the element with
|
||||||
// before the element with index j.
|
// index i should sort before the element with index j.
|
||||||
Less(i, j int) bool
|
Less(i, j int) bool
|
||||||
// Swap swaps the elements with indexes i and j.
|
// Swap swaps the elements with indexes i and j.
|
||||||
Swap(i, j int)
|
Swap(i, j int)
|
||||||
|
@ -201,7 +201,7 @@ func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTrue returns whether the value is 'true', in the sense of not the zero of its type,
|
// isTrue reports whether the value is 'true', in the sense of not the zero of its type,
|
||||||
// and whether the value has a meaningful truth value.
|
// and whether the value has a meaningful truth value.
|
||||||
func isTrue(val reflect.Value) (truth, ok bool) {
|
func isTrue(val reflect.Value) (truth, ok bool) {
|
||||||
if !val.IsValid() {
|
if !val.IsValid() {
|
||||||
|
Loading…
Reference in New Issue
Block a user