A tool, that helps to create pointers on the fly.
For APIs, tests, etc
Usage:
import"github.com/spirin/pointer"typeBar{}
funcmain() {
pObj:=pointer.Of(Bar{})
pString:=pointer.Of("some string")
pIntA:=pointer.Of(1)
pIntB:=pointer.Of(2)
ifpointer.Equal(pIntA, pIntB){
...
}
ifpointer.EqualValue(pIntA, 123){
...
}
fmt.Println(pointer.Value(pIntB, 123))
// types that cannot be autoresolvedpInt64:=pointer.Int64(1)
pFloat16:=pointer.Float16(1)
...
}