

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Linting
incomplete
2: CI Linting
incomplete
3: Linting Review
incomplete
This lesson's interactive features are locked, please to keep using them
"Linting" can be such a vague and confusing term. I want to go over a few of the most common and useful checks that staticcheck lints for, just so you can see a few more examples.
If you're curious, you can see the full list of checks here.
This is the one we've been using so far. It checks for unused variables, functions, and types.
This one is pretty self-explanatory. It checks for invalid Printf calls. For example, if you try to print a string with a %d format specifier, you'll get an error.
Defers in range loops may not run when you expect them to, and in general you should just avoid them.
Before:
for i, x := range src {
dst[i] = x
}
After:
copy(dst, src)