如果-其他条件

I am interested in adding content to a GO template based on some conditions. I have a struct defined like this -

{

    "resourceActions": {
    "update": {
    "input": null,
    "output": "instance",
    },
    "stop": {
    "input": "instanceStop",
    "output": "instance",
    },
    "console": {
    "input": "instanceConsoleInput",
    "output": "instanceConsole",
    },
    "restart": {
    "input": null,
    "output": "instance",
    },
    "remove": {
    "input": null,
    "output": "instance",
    },

}

I need to iterate over "resourceActions" and if the action defined within that like update, restart etc has input as null then generate "A()" else generate A(input *{inputVAL})

Example -

{

    for Update -  A()
    for stop -  A(input *instanceStop)
    for console - A(input *instanceConsoleInput)
    for restart - A()

}

How can I do this in GO-tempaltes

I solved my issue like this -

{
    {{ $temp := .schema.Id }}
    {{if .Input}} func (c *Container) {{$key }}(input *{{.Input}}) *{{$temp}}{} {{else}} func (c *Container) {{$key}}() *{{$temp}}{}{{end}}
}

This works fine in GO templates.