CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' *.go
- structs
- Various utilities to work with Go (Golang) structs.
map[string]interface{}struct conversion.
github.com/fatih/structs
| package main | |
| import ( | |
| "bytes" | |
| "compress/gzip" | |
| "errors" | |
| "fmt" | |
| "io" | |
| ) |
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' *.go
map[string]interface{} struct conversion.github.com/fatih/structs| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| // limiter is a counting semaphore for limiting concurrency in action function. | |
| var limiter = make(chan struct{}, 4) |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/gob" | |
| "fmt" | |
| "github.com/peterbourgon/diskv" | |
| ) |
| package profiler | |
| import ( | |
| "github.com/wblakecaldwell/profiler" | |
| "net/http" | |
| "sync" | |
| ) | |
| var cache = struct { | |
| sync.RWMutex |
| Section "InputClass" | |
| Identifier "touchpad catchall" | |
| Driver "synaptics" | |
| MatchIsTouchpad "on" | |
| Option "TapButton1" "1" | |
| Option "TapButton2" "3" | |
| Option "TapButton3" "2" | |
| Option "VertEdgeScroll" "1" | |
| Option "HorizEdgeScroll" "1" | |
| Option "VertTwoFingerScroll" "1" |
| module MethodInterception | |
| def before_filter(*meths, &blk) | |
| return @wrap_next_method = true if meths.empty? | |
| meths.delete_if { |meth| wrap(meth, &blk) if method_defined?(meth) } | |
| @intercepted_methods += meths | |
| end | |
| private | |
| def wrap(meth, &blk) |
| String.class_eval do | |
| alias_method :original_initialize, :initialize | |
| def initialize(*args) | |
| # https://www.ruby-forum.com/topic/1893190 | |
| c = caller(0) | |
| case | |
| when c.to_s.include?('module:V1') | |
| instance_eval do | |
| def to_v1 |
| module Abstract | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| end | |
| def hello | |
| 'hello from instance method' | |
| end | |
| module ClassMethods |