Added code style rule for outdated code

This commit is contained in:
Eduard Urbach 2018-09-27 17:12:08 +09:00
parent b13572edd5
commit 494d21910c

View File

@ -8,6 +8,7 @@ This document is only meant to teach you the code style used in this project and
* [Variable names](#variable-names) * [Variable names](#variable-names)
* [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)
* [Package names](#package-names) * [Package names](#package-names)
* [Use gofmt](#use-gofmt) * [Use gofmt](#use-gofmt)
* [Code editor](#code-editor) * [Code editor](#code-editor)
@ -151,6 +152,10 @@ type MyType struct {
} }
``` ```
## Don't comment out outdated code
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).
## 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.