Package iterable has outlived its utility.
It is an interesting demonstration, but it encourages
people to use iteration over channels where simple
iteration over array indices or a linked list would be
cheaper, simpler, and have fewer races.
R=dsymonds, r
CC=golang-dev
https://golang.org/cl/2436041
An exercise in reflection and an unusual tool.
From the usage message:
usage: gotry [packagedirectory] expression ...
Given one expression, gotry attempts to evaluate that expression.
Given multiple expressions, gotry treats them as a list of arguments
and result values and attempts to find a function in the package
that, given the first few expressions as arguments, evaluates to
the remaining expressions as results. If the first expression has
methods, it will also search for applicable methods.
If there are multiple expressions, a package directory must be
specified. If there is a package argument, the expressions are
evaluated in an environment that includes
import . "packagedirectory"
Examples:
gotry 3+4
# evaluates to 7
gotry strings '"abc"' '"c"' 7-5
# finds strings.Index etc.
gotry regexp 'MustCompile("^[0-9]+")' '"12345"' true
# finds Regexp.MatchString
R=rsc, PeterGo, r2
CC=golang-dev
https://golang.org/cl/2352043
Permits one to easily put a timeout in a select:
select {
case <-ch:
// foo
case <-time.After(1e6):
// bar
}
R=r, rog, rsc, sameer1, PeterGo, iant, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/2321043
Auto-detect both if not set, and if GOARCH is not set use GOHOSTARCH.
GOHOSTARCH is used to set the -m32 or -m64 flags for gcc.
This is so that 64-bit can build binaries that run on 32-bit systems.
R=rsc, iant, brainman
CC=golang-dev
https://golang.org/cl/2342045
was
x.go:7: must call (&b).*Buffer·Write
now
x.go:7: method b.Write is not an expression, must be called
Fixes#1171.
R=ken2
CC=golang-dev
https://golang.org/cl/2384042
was
x.go:4: invalid operation: 1 <- "foo" (send to receive-only type int)
now
x.go:4: invalid operation: 1 <- "foo" (send to non-chan type int)
R=ken2
CC=golang-dev
https://golang.org/cl/2330042
On Linux, overwriting an mmap'ed file causes
all the MAP_PRIVATE pages to get refreshed
with the new content, even ones that have been
modified by the process that did the mmap.
One specific instance of this is that after the
dynamic linker has relocated a page from a .so,
overwriting the .so will un-relocate it, making
the next use of one of the no-longer-relocated
addresses incorrect and probably crash the
program.
Linux must go out of its way to break programs
in this way: the pages have already been copied
on write, so they're not shared with the file system
cache, and it trashes them anyway. The manual
says the behavior when the file gets overwritten
is "undefined". Removing before copy avoids the
undefined behavior.
R=iant
CC=golang-dev, msolo
https://golang.org/cl/2333045