2019/03/27

gin,appengine,graphql test

gin+GAE+graphql のテスト下記で行けった。 appEngineTestInstance ->instance.NewRequest gin.Context(request) context.Set(key value) ``` ins, _ := aetest.NewInstance(nil) req, _ := ins.NewRequest("", "", nil) var context *gin.Context context = &gin.Context{Request: req} b, _ := json.Marshal(x.y{z: "1"}) context.Set("key", b) `...

2019/03/18

2019/03/05

Removing packages installed with go get

juse delete the source and package 麻烦,要是有一个命令就好了,找一下 It's safe to just delete the source directory and compiled package file. Find the source directory under $GOPATH/src and the package file under $GOPATH/pkg/<architecture>, for example: $GOPATH/pkg/windows_amd64. example go get github.com/golang/mock/mockgen go clean -i github.com/golang/mock/mockgen The -i flag causes clean to remove the corresponding installed archive or binary (what 'go install' would create). The -n flag causes clean to print the remove...

2019/03/04

go gin validator omitempty

細かくて面倒 ・Pointer推奨、nilとZeroValueを区別するため ・bindingはpointerに対しても有効 ・omtiemptyが必須ね。。 type XXXRequest struct { Adate *time.Time `json:"aDate,omitempty" time_format:"2006-01-02”`  B *float64`json:"b,omitempty" binding:"omitempty,min=-90,max=90”`  C *float64 `json:"c,omitempty" binding:"omitempty,min=-180,max=180”` ...