I am coding a library, for example one about graphs. In a repo I have this folder structure:
red_black_tree <- folder
— Key.go <- interface
— Node.go <- struct definition of a node & its operations (implemented)
— RedBlack.go <- the actual code for my RedBlack tree
— RedBlack_test.go <- unit tests for the red black tree
All the 4 .go files belong to the same package reblack.
Here are a few Golang best practices questions:
- should the name of the 4 files be lowercase (key.go instead of Key.go) ?
- should the longer file name be using underscores: red_black.go instead of RebBlack.go ?
- the unit test file needs to end in _test.go, should it be named red_black_test.go ?
- the unit test file is in package redblack, should I define it to belong to package redblack_test ?
Please tell me what are the best practices/usual habits regarding these questions. I understand that it may be just a matter of taste with some of them, but I am still curious about best practices.