Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File name convention for compound words?

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.

like image 995
sschmeck Avatar asked Feb 29 '16 07:02

sschmeck


People also ask

What is the best naming convention for files?

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.

What is naming convention for filename?

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.

Is filename 1 or 2 words?

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."


1 Answers

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.

like image 164
elithrar Avatar answered Sep 19 '22 18:09

elithrar