46 lines
831 B
Go
46 lines
831 B
Go
|
package main
|
||
|
//go:generate pgen
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"go/token"
|
||
|
"gitlab.wow.st/gmp/persist"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
persist.Init()
|
||
|
x := persistInt("x",5)
|
||
|
var y1 mine1 = 6
|
||
|
y2 := mine2{}
|
||
|
y1p := persistM1("y",y1)
|
||
|
y2p := persistM2("y",y2)
|
||
|
y3 := token.FileSet{}
|
||
|
y3p := persistM3("y",y3)
|
||
|
y4 := make(map[*token.FileSet]*token.File)
|
||
|
y4p := persistM4("y",y4)
|
||
|
y5 := make(map[*token.FileSet]*persist.Var)
|
||
|
y5p := persistM5("y",y5)
|
||
|
y6 := make(map[persist.Var]token.FileSet)
|
||
|
y6p := persistM6("y",y6)
|
||
|
_,_,_,_,_,_ = y1p, y2p, y3p, y4p, y5p, y6p
|
||
|
fmt.Println(x)
|
||
|
fmt.Println(x.Get())
|
||
|
x.Set(3)
|
||
|
fmt.Println(x)
|
||
|
|
||
|
z := func(interface{}) {
|
||
|
_ = persistFloat("y",1.0)
|
||
|
}
|
||
|
z(persistString("name","ok"))
|
||
|
|
||
|
s := persistString("s","ok bye")
|
||
|
fmt.Println(s)
|
||
|
s.Set("one two")
|
||
|
var ts string
|
||
|
|
||
|
ts = s.Get() // this works
|
||
|
_ = ts
|
||
|
persist.Commit()
|
||
|
}
|
||
|
|