Skip to content

Instantly share code, notes, and snippets.

package main
import (
"flag"
"fmt"
"log"
"os"
"os/exec"
"path"
"path/filepath"
// go build -ldflags "-X main.BuildStamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.GitHash=`git rev-parse HEAD`" main.go
package main
import (
"fmt"
)
var (
BuildStamp = ""
@mmirolim
mmirolim / index.gohtml
Last active August 28, 2015 06:11 — forked from ericlagergren/index.gohtml
Hot-reloading / hot-swapping live template files in Go
My name is {{.Name}} and I'm {{.Age}} years old!!
package main
import (
"fmt"
"log"
"net/http"
"strings"
"sync/atomic"
"time"
"unicode/utf8"
package main
import (
"fmt"
"reflect"
)
type Model interface {
GetHello()
}
package gobencoding
import (
"bytes"
"encoding/gob"
"encoding/json"
"log"
"os"
"testing"
)
@mmirolim
mmirolim / byteSlice-map-key-lookup.go
Last active October 24, 2015 19:43
Performance of byteSlice to String in map index lookup
package stringbyte
import (
"os"
"testing"
)
var (
mint = make(map[string]int, 1000)
keyString = "key"
@mmirolim
mmirolim / exp-goroutine.go
Last active October 27, 2015 07:00
to run or not to run goroutine
package pool
import (
"os"
"sync"
"sync/atomic"
"testing"
"time"
)
@mmirolim
mmirolim / cb-example.go
Created October 28, 2015 16:03
example usage for fallback with circuit breaker
package main
import (
"errors"
"log"
"sync/atomic"
"time"
as "github.com/aerospike/aerospike-client-go"
"github.com/rubyist/circuitbreaker"
@mmirolim
mmirolim / http-handler-with-context.go
Created November 5, 2015 22:00
use context with http handlers
package main
import (
"io"
"log"
. "net/http"
"time"
"code.google.com/p/go-uuid/uuid"