package got import ( "encoding/json" "fmt" . "git.eugeniocarvalho.dev/eugeniucarvalho/apicodegen/common" G "github.com/dave/jennifer/jen" ) func createParamsFile(p *Project) (err error) { var ( file = G.NewFile(p.Package) out []byte ) if out, err = json.Marshal(p.Resource.CommonParams); err != nil { return } input := fmt.Sprintf("`%s`", string(out)) file.Id(` var ( UserRequestParams = map[string]*`).Qual(CODE_GEN_V2_COMMON, "Parameter").Id(fmt.Sprintf(`{} ) func init(){ input := %s `, input)).Id(`if err :=`).Qual("encoding/json", "Unmarshal").Id(`([]byte(input),&UserRequestParams); err != nil { panic(err) } }`) // `).Id(string(out)).Id(` return Write(p.Paths.Build("/%s/params.go", p.Package), file) }