Skip to content

Generate getters and setters for struct fields #2271

@dlsniper

Description

@dlsniper

In Go:

  • getters are named as the field name
  • setters are named as the field name prefixed with Set

The plugin should support the "Generate" action for Getters, Setters and Getters and Setters actions.

Example:

package main

type demo struct {
    help string
}

func (d *demo) Help() string {
    return d.help
}

func (d *demo) SetHelp(help string) {
    d.help = help
}

func main() {
    a := &demo{"Help"}
    _ = a
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions