MCPcopy Create free account
hub / github.com/goadesign/goa / fieldCode

Function fieldCode

codegen/cli/cli.go:595–607  ·  view source on GitHub ↗

fieldCode generates code to initialize the data structures fields from the given args. It is used only in templates.

(init *PayloadInitData)

Source from the content-addressed store, hash-verified

593// fieldCode generates code to initialize the data structures fields
594// from the given args. It is used only in templates.
595func fieldCode(init *PayloadInitData) string {
596 varn := "res"
597 if init.ReturnTypeAttribute == "" {
598 varn = "v"
599 }
600 // We can ignore the transform helpers as there won't be any generated
601 // because the args cannot be user types.
602 c, _, err := codegen.InitStructFields(init.Args, varn, "", init.ReturnTypePkg)
603 if err != nil {
604 panic(err) // bug
605 }
606 return c
607}

Callers

nothing calls this directly

Calls 1

InitStructFieldsFunction · 0.92

Tested by

no test coverage detected