Go Linters: Myths and Best Practices
Year: 2019
Labels: clean code, linting
Go Linters: Myths and Best Practices
Speaker(s): Denis Isaev
Video URL: https://www.youtube.com/watch?v=1U-Gzz4TYP0
Summary: In this talk, the speaker introduces the concept of linters related to Golang and debunks some common myths about linting. He explains the importance linters play in maintaining high code quality and discuss different types of linter checks plus best practices for using linters. The speaker has developed golangci-lint
which is a tool that aggregates multiple Go linters into one.
Timestamps
00:00
- Introduction00:50
- What is a Linter?01:35
- Linting Myth #103:00
- Linting Myth #205:45
- Linting Myth #306:20
- Formatting Check07:55
- Complexity Check09:45
- Style Check12:15
- Unused Code Check15:15
- Bug Finding18:10
- Which Go linters should be used?18:55
- Linting Myth #421:25
- Introducing golangci-lint23:40
- Linting Myth #529:25
- Best Practices35:15
- Writing Own Linters35:55
- Summary
Key Takeaways
golangci-lint
is aggregates multiple Go linters into a single tool. This integration simplifies the linting process by running various static analysis checks simultaneously, helping developers maintain high code quality and follow best practices without needing to configure and run each linter individually.- During the talk, the following myths regarding linting are busted:
- Linters don't find real bugs
- Linters do more harm than good
- There are too many linters, only use 2-3
- Running linters is too slow
- It's too late to introduce linters to already big projects
Questions/Discussion Points
- What configurations are commonly used for .golangci.yml - or is the default most common? Is the default "enough"?