Questions
Go questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Read Standard Input in Go
Learn how to read user input from the console in Go using bufio.Reader, fmt.Scanln, and common input-handling patterns.
How to Read a File Line by Line in Go
Learn how to read a file line by line in Go using bufio.Scanner and readers, with examples, pitfalls, and practical patterns.
How to Read an Entire File Into a String in Go
Learn how to read a whole file into a string in Go using standard library functions, with examples, pitfalls, and practical use cases.
How to Read and Write Files in Go
Learn how to read from and write to files in Go with simple examples, file handles, byte slices, and common patterns for beginners.
How to Remove Packages Installed with go get in Go
Learn how go get installs packages, where files go, and how to remove previously downloaded Go packages safely and cleanly.
How to Run All Go Tests in a Project with go test
Learn how to run all tests in a Go project using go test across the current directory and all subdirectories.
How to Run Specific Go Tests: File vs Test Name in Go
Learn how to run specific Go tests using go test, -run, and package rules. Understand why Go targets packages, not test files.
How to Send JSON in a POST Request in Go
Learn how to send JSON in a POST request in Go, including dynamic JSON bodies, headers, marshaling, and common mistakes.
How to Set GOPATH on Ubuntu in Go
Learn what GOPATH is, where to set it on Ubuntu, which shell file to edit, and how it affects go get and Go projects.
How to Use go get with Private Repositories in Go
Learn the proper way to use go get with private Git repositories in Go, including SSH setup, GOPRIVATE, and common mistakes.
How to Write Multiline Strings in Go
Learn how multiline strings work in Go using raw string literals and escaped strings, with examples, pitfalls, and practical use cases.
Idiomatic Enums in Go: Representing Fixed Values Like DNA Bases
Learn the idiomatic way to represent enums in Go using typed constants and iota, with examples for DNA bases like A, C, T, and G.
Optional Parameters in Go: How to Handle Missing Arguments
Learn how Go handles optional parameters, why function overloading is not supported, and common patterns to simulate optional arguments.
Struct Tags in Go: What They Are and How They’re Used
Learn what struct tags in Go are, how reflection reads them, and how packages like json, xml, db, and validation use them in real projects.
Understanding "does not implement interface" with Pointer Receivers in Go
Learn why Go shows "does not implement interface" with pointer receivers, how method sets work, and how to fix common interface errors.
Understanding GOPATH and GOROOT in Go
Learn what GOPATH and GOROOT mean in Go, how they differ, and how to fix package not found errors during installation.
Understanding rune in Go: Characters, Unicode, and Case Swapping
Learn what a rune is in Go, how it differs from byte, and how rune comparisons work in case-swapping examples.
When Does init() Run in Go? Package Initialization Explained
Learn exactly when Go's init() runs, how package variables are initialized, and what happens before main() starts.
Why Go Cannot Convert []T to []interface{} Implicitly
Learn why Go does not convert []T to []interface{} automatically, how slice memory differs, and the correct way to convert slices safely.
Why Go Does Not Have a Built-In Set Type: Understanding Sets with Maps in Go
Learn why Go has no built-in set type and how to implement sets using maps, with examples, trade-offs, and beginner-friendly guidance.