Skip to content

proposal: cmd/go: generate allow arguments to span multiple lines #46050

@andig

Description

@andig

Go does encourage use of generated code by using go generate and the respective //go:generate build comments.

Working with implementing optional interfaces that a go object might chose to provide to extend a base interface type at runtime, I've come across the need to write long build comments like https://github.com/andig/evcc/blob/master/internal/vehicle/vehicle.go#L28

For readability it would be great if these could be supplied as multi-line comment. This could look like this:

//go:generate go run ../../cmd/tools/decorate.go 
//-p vehicle -f decorateVehicle -b api.Vehicle -o vehicle_decorators 
//-t "api.ChargeState,Status,func() (api.ChargeStatus, error)" 
//-t "api.VehicleRange,Range,func() (int64, error)"

I would like to propose to allow multi-line comments, given that the comment marker // is not followed by a space ( ).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions