Is the convention for naming slices in Go? Specifically, do you use plurals? I've noticed that Go App Engine doesn't (eg. it uses key
not keys
):
func GetMulti(c appengine.Context, key []*Key, dst interface{}) error
I haven't seen anything equivalent in the standard packages or docs I've read. Is singular or plural normal?
That should be a typo, I guess.
Names of slices and arrays are plural. It's not hard to find some samples in the standard library: function SetCookies
in CookieJar
, Readdirnames
, or Args
variable in the variables of os package.
But for any variable use a name that better explains its purpose.
A clear exception to this all-plural approach is argv
which had its name for decades.