You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Signatures of functions taking a lot of parameters are quickly exceeding a readable line length (80-120 characters).
func httpHandlerFunc(logger *log.Logger, db *sql.DB, imgCache map[string]io.Reader, w http.ResponseWriter, r *http.Request)
To make this more readable one can put each parameter on an individual line like so:
func httpHandlerFunc(
logger *log.Logger,
db *sql.DB,
imgCache map[string]io.Reader,
w http.ResponseWriter,
r *http.Request,
)
In contrast to most other forms e.g. imports, structs, variable and constant declarations gofmt does not align this form. I propose that this form should be recognised by gofmt and parameter names and parameter types be appropriately aligned.
func httpHandlerFunc(
logger *log.Logger,
db *sql.DB,
imgCache map[string]io.Reader,
w http.ResponseWriter,
r *http.Request,
)
The objective of this proposal is to increase readability and make formatting rules more consistent.
The text was updated successfully, but these errors were encountered:
Sorry, but gofmt is pretty much frozen at this point. Thanks for the issue.
As the syntax for contracts evolves and becomes more concrete, I would reopen a proposal specific to that, but we're still too early to be talking about code formatting since we don't know what the final syntax is.
Signatures of functions taking a lot of parameters are quickly exceeding a readable line length (80-120 characters).
To make this more readable one can put each parameter on an individual line like so:
In contrast to most other forms e.g. imports, structs, variable and constant declarations gofmt does not align this form. I propose that this form should be recognised by gofmt and parameter names and parameter types be appropriately aligned.
The objective of this proposal is to increase readability and make formatting rules more consistent.
The text was updated successfully, but these errors were encountered: