Comment formatting

This commit is contained in:
Eduard Urbach 2018-10-27 06:11:31 +09:00
parent d4b31b5bc1
commit 124d1937ae

View File

@ -9,6 +9,7 @@ This document is only meant to teach you the code style used in this project and
* [Types at the top](#types-at-the-top) * [Types at the top](#types-at-the-top)
* [Private fields at the end of a struct](#private-fields-at-the-end-of-a-struct) * [Private fields at the end of a struct](#private-fields-at-the-end-of-a-struct)
* [Don't comment out outdated code](#dont-comment-out-outdated-code) * [Don't comment out outdated code](#dont-comment-out-outdated-code)
* [Comments start with space and uppercase](#comments-start-with-space-and-uppercase)
* [Package names](#package-names) * [Package names](#package-names)
* [Use gofmt](#use-gofmt) * [Use gofmt](#use-gofmt)
* [Code editor](#code-editor) * [Code editor](#code-editor)
@ -156,6 +157,14 @@ type MyType struct {
You should delete outdated code instead of commenting it out. Comments should be used for explanation of existing code and outdated code is saved in the git history anyway if you ever need it (in most cases outdated code is never re-used). You should delete outdated code instead of commenting it out. Comments should be used for explanation of existing code and outdated code is saved in the git history anyway if you ever need it (in most cases outdated code is never re-used).
# Comments start with space and uppercase
Example:
```go
// This comment starts with a space and an uppercase letter.
```
## Package names ## Package names
Package names should be short lowercase identifiers and tests should be written using the black box pattern. Black box testing can be enabled by adding the suffix `_test` to the package names in `*_test.go` files. It will enable you to test your library like it would be used by another developer, without internal access to private variables. Package names should be short lowercase identifiers and tests should be written using the black box pattern. Black box testing can be enabled by adding the suffix `_test` to the package names in `*_test.go` files. It will enable you to test your library like it would be used by another developer, without internal access to private variables.