patterngoCritical
Go naming conventions for const
Viewed 0 times
namingconventionsconstfor
Problem
I'm trying to determine whether there is a naming convention for the names of
I personally would tend to follow the C style and write them in upper case, but I haven't found anything on this page http://golang.org/doc/effective_go.html which seems to list some naming conventions for the language.
const in Golang.I personally would tend to follow the C style and write them in upper case, but I haven't found anything on this page http://golang.org/doc/effective_go.html which seems to list some naming conventions for the language.
Solution
The standard library uses camel-case, so I advise you do that as well. The first letter is uppercase or lowercase depending on whether you want to export the constant.
A few examples:
A few examples:
md5.BlockSize
os.O_RDONLYis an exception because it was borrowed directly from POSIX.
os.PathSeparator
Context
Stack Overflow Q#22688906, score: 240
Revisions (0)
No revisions yet.