By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Every programmer sees errors all day, including people who have been writing Go for ten years. The skill you are building is not "never make mistakes". It is read the message, find the location, change one thing, run again.
This file is missing a closing quote. That is deliberate: do not fix it yet. Copy it into main.go, run go run ., and read what the compiler says.
package main
import "fmt"
func main() {
fmt.Println("Hello, Penny!)
}The compiler prints a file, a line, a column and a message. You have seen something like this:
# main.go:6:14: string literal not terminated
# | |
# | +-- column 14: where the scanner gave up
# +-------- line 6: the line to inspectThe fix is one character: close the string and add the closing parenthesis. The terminal does not need the comment; it is there to label the output.
package main
import "fmt"
func main() {
fmt.Println("Hello, Penny!")
}| Message (approximately) | Usually means | Fix |
|---|---|---|
undefined: prntln | A name is misspelled or not declared. | Compare the spelling; check the package name before the dot. |
string literal not terminated | A quote is missing or the string spans lines. | Close the string on the same line, or use a raw string with backticks. |
declared and not used | A variable was created but never read. | Use it in the program or delete the line. |
gofmt rewrites your file into the standard Go layout. go vet looks for suspicious code that compiles but is probably a mistake. Run both before you ask for help or open a pull request.
# Format every Go file in place. No output means it was already clean.
gofmt -w main.go
# Run the vet checker over the current module.
go vet ./...Deliberately introduce one error: delete a closing brace, run the program, and write down the first line of the error. Then fix it and confirm the program runs. Do this with three different errors. Recognising the shape of an error is worth more than avoiding it.
Key takeaways
Read errors as file, line, column, message - then change one thing.
Fix the first error first; others may disappear.
Missing quotes, misspelled names and unused variables cause most beginner errors.
gofmt -w and go vet ./... are part of the normal loop.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.