This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync" | |
"fmt" | |
) | |
// DO NOT DO THIS. | |
func main() { | |
l := new(sync.Mutex) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "sort" | |
func main() { | |
m := map[string]int{ | |
"One": 1, | |
"Two": 2, | |
"Three": 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/cmplx" | |
) | |
func Cbrt(x complex128) (z complex128) { | |
// Initial guess is x | |
z = x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"fmt" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include $(GOROOT)/src/Make.inc | |
PROTOFILES=$(wildcard *.proto) | |
GOPROTOFILES=$(patsubst %.proto,%.pb.go,$(PROTOFILES)) | |
TARG=protopackage | |
GOFILES=\ | |
$(GOPROTOFILES)\ | |
CLEANFILES+=$(GOPROTOFILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "strconv" | |
func b(bin string) uint8 { | |
n, _ := strconv.Btoui64(bin, 2) | |
return uint8(n) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type day int | |
const ( | |
Sunday day = iota | |
Monday | |
Tuesday | |
Wednesday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
) | |
func (c *bytes.Buffer) String() string { | |
return "Whut?" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func foo(i int, s string) { | |
fmt.Println("foo", i, s) | |
} | |
func bar(s string) { | |
fmt.Println("bar", s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rm VERSION ../VERSION | |
rm: cannot remove `VERSION': No such file or directory | |
rm: cannot remove `../VERSION': No such file or directory | |
$ hg id | |
d7322ae4d055+ weekly.2011-09-21 | |
$ ./version.bash | |
weekly.2011-11-09 9839+ | |
$ hg tags | grep weekly | sed 's/:.*//' | |
weekly.2011-11-09 10370 | |
weekly 10370 |