From 494d21910cad6a078db90014f0e5c72a725a40e2 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 27 Sep 2018 17:12:08 +0900 Subject: [PATCH] Added code style rule for outdated code --- docs/code-style.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/code-style.md b/docs/code-style.md index 38a859ca..57caf8fc 100644 --- a/docs/code-style.md +++ b/docs/code-style.md @@ -8,6 +8,7 @@ This document is only meant to teach you the code style used in this project and * [Variable names](#variable-names) * [Types at the top](#types-at-the-top) * [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) * [Use gofmt](#use-gofmt) * [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 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.