Go R1 Day 52

  • 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).
1
2
3
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 length
    • packagetest: for emphasizing blackbox testing.
    • gochecknoglobals: for ensuring global variables aren’t used
    • nlreturn: 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.)

feat: structs-methods-and-interfaces -> initial functions without str… · sheldonhull/learn-go-with-tests-applied@be9ce01 · GitHub


Webmentions

Likes  (4) Reposts  (2)