Edit: This list is now maintained in the rust-anthology repo.
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 deepcopy provides a function for deep copying map[string]interface{} | |
// values. Inspired by the StackOverflow answer at: | |
// http://stackoverflow.com/a/28579297/1366283 | |
// | |
// Uses the golang.org/pkg/encoding/gob package to do this and therefore has the | |
// same caveats. | |
// See: https://blog.golang.org/gobs-of-data | |
// See: https://golang.org/pkg/encoding/gob/ | |
package deepcopy |
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" | |
"reflect" | |
) | |
func Decorate(impl interface{}) interface{} { | |
fn := reflect.ValueOf(impl) |
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
// Simple groupcache example: https://github.com/golang/groupcache | |
// Running 3 instances: | |
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082 | |
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081 | |
// Testing: | |
// curl localhost:8080/color?name=red | |
package main | |
import ( |
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" | |
"os" | |
"syscall" | |
"unsafe" | |
) | |
var ( |
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
# See docs/examples | |
# http://doc.gitlab.com/ce/ci/quick_start/README.html | |
# http://doc.gitlab.com/ce/ci/yaml/README.html | |
# GitLab CI template for Go tests. Note this installs | |
# a new working copy of Go in a non-standard path such | |
# that sudo/root is not needed for the install stage. | |
# note that this particular install-environment stage | |
# is overly verbose in order to debug anything tricky |
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
// First: go get github.com/golang/glog | |
// Then : go test -v -vmodule=*=3 -logtostderr netgrace_test.go | |
// This test package shows how to gracefully shutdown a net.Listener. | |
package netgrace | |
import ( | |
"bufio" | |
"fmt" | |
"github.com/golang/glog" |

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 components | |
import "syscall" | |
func setpriority() { | |
syscall.Setpriority(syscall.PRIO_PGRP, 0, 9) | |
} |