}

Golang Index Page 1

SOLVED: function main is undeclared in the main package (Go)

Fix Go error "function main is undeclared in the main package". Causes: wrong package name, missing main(), running go run on wrong file, or build tags.

Golang Index Page 1

Fix 'cannot use X (type Y) as type Z' in Go — Type Mismatch Guide

Fix 'cannot use X (type Y) as type Z' in Go. Covers explicit conversions, interface satisfaction, pointer vs value receivers, and type assertions with the ok pattern.

Golang Index Page 1

Go: Convert Rune to String and String to Rune — Complete Guide (2026)

Convert rune to string in Go with string(r). Convert string to rune slice with []rune(s). Covers Unicode, utf8 package, for range iteration, and rune vs byte.

Golang Index Page 1

Go: Convert String to Int (and Int to String) — Complete Guide (2026)

Convert string to int in Go using strconv.Atoi, strconv.ParseInt, fmt.Sscanf. Convert int to string with strconv.Itoa, FormatInt, Sprintf. All methods compared.

Golang Index Page 1

Fix 'declared and not used' Error in Go (2026)

Fix Go's 'declared and not used' compile error. Learn why Go enforces this, how to use the blank identifier _, and common cases like loop variables and error returns.

Golang Index Page 1

Fix: "function main is undeclared in the main package" in Go

Fix the Go error "runtime.main_main·f: function main is undeclared in the main package". Covers all 5 causes with code examples and step-by-step solutions.

Golang Index Page 1

go mod tidy Explained: Clean Up Go Module Dependencies (2026)

go mod tidy adds missing and removes unused dependencies from go.mod and go.sum. Learn go mod download, verify, vendor, -e flag, and common post-tidy errors.

Golang Index Page 1

Go error: "imported and not used" — Fix Unused Import Compile Error

Fix the Go compiler error "imported and not used". Learn why Go enforces this rule and the 4 ways to resolve it: remove the import, use it, blank import, or goimports.

Golang Index Page 1

Fix 'nil pointer dereference' Panic in Go (2026)

Fix Go's 'nil pointer dereference' runtime panic. Covers nil pointers, nil interfaces, nil maps, uninitialized structs, stack trace reading, and nil-safe patterns.

Golang Index Page 1

Fix 'undefined: functionName' Error in Go (2026)

Fix the Go 'undefined: functionName' compile error. Covers wrong package, unexported names, typos, missing imports, and circular imports with before/after code.