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. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/11458046
This commit is contained in:
parent
75919c8eee
commit
9ac8940d29
|
@ -275,7 +275,7 @@ func htmlGen(w io.Writer, src []byte, tokens []Token) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// startBrowser tries to open the URL in a browser
|
// startBrowser tries to open the URL in a browser
|
||||||
// and returns whether it succeed.
|
// and reports whether it succeeds.
|
||||||
func startBrowser(url string) bool {
|
func startBrowser(url string) bool {
|
||||||
// try to start the browser
|
// try to start the browser
|
||||||
var args []string
|
var args []string
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (v *RWValue) Get() (interface{}, time.Time) {
|
||||||
return v.value, v.timestamp
|
return v.value, v.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsText returns whether a significant prefix of s looks like correct UTF-8;
|
// IsText reports whether a significant prefix of s looks like correct UTF-8;
|
||||||
// that is, if it is likely that s is human-readable text.
|
// that is, if it is likely that s is human-readable text.
|
||||||
func IsText(s []byte) bool {
|
func IsText(s []byte) bool {
|
||||||
const max = 1024 // at least utf8.UTFMax
|
const max = 1024 // at least utf8.UTFMax
|
||||||
|
@ -61,7 +61,7 @@ var textExt = map[string]bool{
|
||||||
".js": false, // must be served raw
|
".js": false, // must be served raw
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsTextFile returns whether the file has a known extension indicating
|
// IsTextFile reports whether the file has a known extension indicating
|
||||||
// a text file, or if a significant chunk of the specified file looks like
|
// a text file, or if a significant chunk of the specified file looks like
|
||||||
// correct UTF-8; that is, if it is likely that the file contains human-
|
// correct UTF-8; that is, if it is likely that the file contains human-
|
||||||
// readable text.
|
// readable text.
|
||||||
|
|
Loading…
Reference in New Issue