github.com/chrislusf/greenpack@v3.7.1-0.20170911073826-ad5bd10b7c47+incompatible/_generated/issue94.go (about) 1 package _generated 2 3 import ( 4 "time" 5 ) 6 7 //go:generate greenpack 8 9 // Issue 94: shims were not propogated recursively, 10 // which caused shims that weren't at the top level 11 // to be silently ignored. 12 // 13 // The following line will generate an error after 14 // the code is generated if the generated code doesn't 15 // have the right identifier in it. 16 17 //go:generate ./search.sh $GOFILE timetostr 18 19 //msgp:shim time.Time as:string using:timetostr/strtotime 20 type T struct { 21 T time.Time 22 } 23 24 func timetostr(t time.Time) string { 25 return t.Format(time.RFC3339) 26 } 27 28 func strtotime(s string) time.Time { 29 t, _ := time.Parse(time.RFC3339, s) 30 return t 31 }