Skip to content

Instantly share code, notes, and snippets.

View notzippy's full-sized avatar

Steve notzippy

View GitHub Profile
@notzippy
notzippy / log.go
Created July 21, 2018 17:43
Revel embedding zap logger
package logger
// LoggedError is wrapper to differentiate logged panics from unexpected ones.
import (
"os"
"fmt"
"strings"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
@notzippy
notzippy / gist:3ff69611e6b97b3a769ff6e578bf8ff1
Created February 28, 2017 00:40
The fun golang laws of reflection - Create a new structure from a pointer using reflection. The returned interface is an instantiated not empty
Using the passed in pointer to an interface create a new instantiated structure (not an empty address)
func Update(foo interface{}) {
result := reflect.New(reflect.ValueOf(update).Elem().Type()).Interface()
}