Skip to content

Commit

Permalink
Go Linters: Myths and Best Practices
Browse files Browse the repository at this point in the history
  • Loading branch information
angelicagardner authored Jun 12, 2024
2 parents 595acf9 + 6712dd5 commit 86e7684
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ jobs:
with:
ref: main

- name: Fetch all branches
run: git fetch origin "+refs/heads/*:refs/remotes/origin/*"

- name: Checkout dev branch
run: git checkout dev

- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout dev branch
run: |
git checkout dev
git rebase main
- name: Rebase dev onto main
run: git rebase main

- name: Push changes
run: |
git push origin dev --force
run: git push origin dev --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
51 changes: 51 additions & 0 deletions talks/go-linters-myths-best-practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "Go Linters: Myths and Best Practices"
labels: "clean code, linting"
year: 2019
---

# 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` - Introduction
- `00:50` - What is a Linter?
- `01:35` - Linting Myth #1
- `03:00` - Linting Myth #2
- `05:45` - Linting Myth #3
- `06:20` - Formatting Check
- `07:55` - Complexity Check
- `09:45` - Style Check
- `12:15` - Unused Code Check
- `15:15` - Bug Finding
- `18:10` - Which Go linters should be used?
- `18:55` - Linting Myth #4
- `21:25` - Introducing golangci-lint
- `23:40` - Linting Myth #5
- `29:25` - Best Practices
- `35:15` - Writing Own Linters
- `35: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"?

## Links/Resources

- [golangci-lint](https://golangci-lint.run/)

0 comments on commit 86e7684

Please sign in to comment.