Grokking Advanced Go
0% completed
go vet and go fix
The two commands in this lesson report very different things about the same file. The program below compiles and runs, and two of its lines are worth attention. The Sprintf call in describe is a bug, while the for loop in main is correct code written in an older style.
Running the program shows the bug in its output, since %d cannot format a string:
order 1001 for %!d(string=Ada) order 1002 for %!d(string=Lin)
The command go vet reports the bug and changes nothing. The command go fix rewrites the loop and reports nothing about the bug
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%