Go errors
- "fmt" imported and not usedGo doesn't compile with unused imports. Remove the import, or let goimports manage imports automatically.
- declared and not usedGo refuses to compile code with unused local variables. Use the variable, remove it, or assign it to the blank identifier _.
- fatal error: all goroutines are asleep - deadlock!Every goroutine in the program is blocked waiting on a channel, mutex or WaitGroup that nothing will ever release, so the Go runtime aborts. Usually an unbuffered send with no receiver, a range over a channel that is never closed, or a WaitGroup count that never reaches zero.
- fatal error: concurrent map writesTwo goroutines wrote to the same Go map at the same time. Go maps are not safe for concurrent use, and the runtime aborts the whole program (this is not a recoverable panic).
- go: cannot find main module, but found .git/configYou ran a go command that needs a module (build, run, test, get, mod tidy) outside any directory with a go.mod file. Create one with go mod init, or run the command from the module's directory.
- missing go.sum entry for module providing packagego.mod lists (or your code imports) a module whose checksum isn't recorded in go.sum, and since Go 1.16 the go command won't add it automatically during build. Run go mod tidy.
- no required module provides packageThe import path isn't provided by any module in your go.mod. Either the dependency hasn't been added, the import path is misspelled, or a local package path doesn't match your module name.
- panic: assignment to entry in nil mapYou wrote to a map that was declared but never initialised. A nil map can be read from, but any write panics. Create it with make() or a literal first.
- panic: runtime error: invalid memory address or nil pointer dereferenceYour code used a nil pointer, nil interface or nil function as if it pointed to something — usually a value returned together with an error that wasn't checked, or a struct field never initialised.
- undefined: XThe Go compiler cannot find a name you used. Usually the file that defines it is not being compiled, the name is unexported from another package, or there is a typo or build-tag mismatch.