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
Thanks for the suggestion! Is your thinking that this would apply to all lists, or just some of them?
If this applies to all of them, I can imagine this meaning trouble. For example, what if a developer is keeping a particular order for some reason? Like:
days := []string{
"Monday",
"Tuesday",
...
}
We also don't want to add more flags beyond what gofmt has, so I don't know how we could make this apply to only some lists. Perhaps a comment, but then we get into ugly directives like //go:sorted.
Yeah, I'm not sure it can be applied everywhere tbh and don't like the idea of the comments. Will close the issue as I think it's something I'm going to just have to keep in the style guide. We do have a caveat on it that points out things like your days example.
One thing that I often find in style guides is the desire to have lists of objects in order to help with readability.
Would be great if we could add a feature to order strings in slices when they are defined.
eg.
goes to:
The text was updated successfully, but these errors were encountered: