Is there a common convention in Go to name files that contain compound words?
For example I wrote an implementation of the Weighted Union Find algorithm and put it into its own source file. How should I name the file?
// mixed case weightedUnionFind.go // lower case weightedunionfind.go // snake case weighted_union_find.go
I found only a convention regarding package names and the following question about file naming conventions in general, What are conventions for filenames in Go?.
Therefore I grepped through Go package source files and ended up with weightedunionfind.go
.
File naming best practices:Avoid special characters or spaces in a file name. Use capitals and underscores instead of periods or spaces or slashes. Use date format ISO 8601: YYYYMMDD.
A File Naming Convention (FNC) is a framework for naming your files in a way that describes what they contain and how they relate to other files. Developing an FNC is done through identifying the key elements of the project, the important differences and commonalities between your files.
The original form of the word was "file name" and "filename" became popular as more people and software programs began to use that version of the word. According to the Microsoft Manual of Style, a file name is "Two words both as an adjective and as a noun when referring to the name of a file. Do not hyphenate."
Although it's not formally specified in https://golang.org/doc/code.html#Overview - snake_case
is the convention across the most of the standard library and most third party libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With