Go R1 Day 52
tech development 100DaysOfCode golang microblog
progress
- published extension pack for Go1
- Learned about magic number linter in
golanglint-ci. For instance this would be flagged as a bad practice (while not applicable for a simple test like this, having a const makes sense in almost all other cases).
func Perimeter(width float64, height float64) float64 {
return 2 * (width + height)
}
- Learned a few extra linter violations and how to exclude including:
lll: for maximum line lengthpackagetest: for emphasizing blackbox testing.gochecknoglobals: for ensuring global variables aren’t usednlreturn: for returning without a black line before. That’s a “nit”, but nice for consistency (though I’d like to see this as an autoformatted rule with fix applied.)