Go template repository to use with go template tool.
go get -u github.com/ncw/gotemplate
go get -u github.com/sreis/gotemplates
- Concurrent Map implementation in package
concurrentmap
Create a file mapstringint.go with:
package main
//go:generate gotemplate "github.com/sreis/gotemplates/concurrentmap" "MapStringInt(string, int)"
And use the new MapStringInt
like so:
package main
import "fmt"
func main() {
cmap := NewMapStringInt()
key := "foobar"
value := 1337
cmap.Set(key, value)
v, ok := cmap.Get(key)
fmt.Println("value ", v, ok)
}
Build with:
make