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.

go

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.

gostringfileparsing

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.

gostringfile

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.

gofile

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.

go

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.

gotesting

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.

go

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.

gojsonrestapiary.io

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.

golinuxubuntu

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.

gogit

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.

gostringmultiline

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.

goenumsgenetics

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.

gooverloading

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.

gostructreflectiontags

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.

gopointersmethodsinterface

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.

gogopath

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.

goterminologyrune

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.

goinit

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.

gogo-reflectgo-interface

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.

godata-structuresset

Page 3 of 4 - 62 questions