Read and fix a Go compiler diagnostic
Read the error before changing code
A compiler diagnostic explains why a program cannot be compiled. It commonly includes a filename, line and column, followed by a message. The exact wording can vary with the toolchain. Try reading this intentionally incorrect example; do not treat it as runnable successful code.
package main
import "fmt"
func main() { fmt.PrintlN("Hello")}Running go run main.go with that source fails with a message containing undefined: fmt.PrintlN. Go is case-sensitive, so PrintlN and Println are different names. The location points to the failed reference.
Make one correction and rerun
The corrected program prints Hello. Fix the first meaningful diagnostic, save, then rerun the command. A single mistake can cause several later errors. Not every diagnostic means the compiler itself has a bug.
Try it locally
Predict the error in fmt.Printlnn("Ready"), then change only the function name and run the corrected program.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Getting Started 08: Read and fix a Go compiler diagnostic
Check the lesson objective before moving on.
What does undefined: fmt.PrintlN indicate?
What should you do after correcting the identifier?