Usage:
// Configure it with a default sample rate
hook, err := fieldsampler.NewFieldSamplerHook(1)
if err != nil {
log.Fatal(err)
}
package fieldsampler | |
import ( | |
"github.com/honeycombio/beeline-go/sample" | |
) | |
const ( | |
// CustomSampleRateFieldName is the field to use to override the default Sample Rate | |
CustomSampleRateFieldName = "CustomSampleRate" |
(function() { | |
window.onerror = function(message, url, line, column) { | |
if (typeof url === "undefined" || url === null || url === "") { | |
return; | |
} | |
var data = JSON.stringify({ | |
message: message, | |
url: url, | |
line: line, |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env bash | |
set -e | |
USAGE="Usage: migrate <up|down|new|init>" | |
# http://www.postgresql.org/docs/9.5/static/libpq-envars.html | |
export PGDATABASE=${PGDATABASE:-meetspace} | |
cd `dirname $0`/../migrations |
Hello and welcome to gobridge's day 1 content! The goal of this page is to guide you through the basics of programming in Go using the site Go by Example.
Please follow along with the class as we do each lesson, try not to skip ahead, and focus on the lesson we're on. If you finish early, play around by changing the code we're working with for the current lesson, or help a friend!
FROM golang | |
ADD main.go ./ | |
RUN go build -o greeter main.go | |
CMD ["./greeter"] |
build: | |
# get all the deps | |
go get -d -v -t ./... | |
# check out the library to the right ref | |
checkit github.com/myaccount/mylib abc123 | |
# build stuff! | |
go build ./... |
// keepDoingSomething will keep trying to doSomething() until either | |
// we get a result from doSomething() or the timeout expires | |
func keepDoingSomething() (bool, error) { | |
timeout := time.After(5 * time.Second) | |
tick := time.Tick(500 * time.Millisecond) | |
// Keep trying until we're timed out or got a result or got an error | |
for { | |
select { | |
// Got a timeout! fail with a timeout error | |
case <-timeout: |
#!/usr/bin/env bash | |
# Makes a docker container for a static golang application. | |
# For a small app, this container is usually about 7mb. | |
# | |
# Usage: | |
# build-container myapp myuser/myapp cmd/myapp/main.go | |
set -e | |
# Version is the git sha for HEAD | |
version=$(git log -1 --format=format:%H) |