upvote
Go design is not around being concise as possible, in fact it's the complete opposite.

One of the cores behind Go is to make language simple, even if at the expense of more verbose code.

Two main examples of this is the infamous 'if err != nil' and how you handle filter/map/funcional operations.

reply
Yes but it’s err not error. The variable and method names are meant to be concise and highly readable without the CS fluff of Java naming hell.
reply
I don't think naming convention is the kind of stuff that helps save tokens, specially considering how text is tokenized.

On the other hand, being able to write 'list.filter(v => v.selected)' (or something similar) instead of:

  listFiltered := []Item{}
  for _, item := range list {
    if item.selected {
      listFiltered = append(listFiltered, item)
    }
  }
would save much more tokens.
reply
You can have that with generic functions, although Go's lambda syntax is too verbose. The slices package has DeleteFunc, which is kind of the opposite. I don't know why they have Filter.

https://pkg.go.dev/slices#DeleteFunc

reply