Questions

Go questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Automatic Build Versioning in Go: Embed Incrementing Build Numbers

Learn how to add automatic build versioning in Go using linker flags, build metadata, CI counters, and Git-based version values.

go

Blank Identifier Imports in Go: What `_` Means in an Import Statement

Learn what `_` means in a Go import, why blank identifier imports run package init code, and when to use them safely.

goimport

Calling Functions Across Files in the Same Go Package

Learn how Go uses packages across multiple files, why functions may appear undefined, and how to organize code correctly.

goundefinedfunc

Can You Declare a Constant Map in Go? Understanding Constants and Maps in Golang

Learn why Go does not allow constant maps, and see practical alternatives using variables, immutability patterns, and safe access.

go

Check if a Value Exists in a Slice in Go

Learn how to check whether a value exists in a slice in Go, and why Go has no Python-style `in` operator for arrays or slices.

goif-statement

Concatenating Slices in Go with append

Learn how to concatenate two slices in Go using append and the ... operator, with examples, pitfalls, and practical usage.

goappendslicevariadic-functions

Constructors in Go: Best Practice for Struct Initialization

Learn how to initialize structs with default values in Go using constructor-style functions, zero values, and idiomatic patterns.

gooopconstructor

Convert String to Integer in Go: Idiomatic Parsing with strconv.Atoi

Learn the idiomatic way to convert a string to an int in Go using strconv.Atoi, with examples, errors, and common mistakes.

gostringtype-conversion

Convert a Byte Slice to io.Reader in Go

Learn how to convert a byte slice to io.Reader in Go using bytes.NewReader and bytes.NewBuffer with clear examples and pitfalls.

go

Convert a Zero-Terminated Byte Array to String in Go

Learn how to convert a zero-terminated byte array to a Go string by trimming trailing null bytes safely and clearly.

go

Default Function Parameter Values in Go

Learn how Go handles default function parameter values, why they are not supported, and practical patterns to achieve similar behavior.

godefault-valuefunction-calldefault-arguments

Deleting Keys from a Map During range in Go

Learn whether it is safe to delete map keys during a range loop in Go, how map iteration works, and common patterns for removal.

godictionaryfor-loop

Difference Between := and = in Go

Learn the difference between := and = in Go, when to declare versus assign variables, and common mistakes beginners make.

go

Does Go Provide a REPL? Understanding Interactive Go Development

Learn whether Go has a REPL, how interactive Go development works, and what tools beginners can use to test Go code quickly.

goread-eval-print-loop

Dynamic JSON Fields in Go: Hiding Struct Fields in API Responses

Learn how to return selected JSON fields from Go structs using maps, custom response types, and dynamic field filtering in APIs.

gojson

Efficient String Concatenation in Go: strings.Builder, bytes.Buffer, and Best Practices

Learn how to concatenate strings efficiently in Go using strings.Builder and bytes.Buffer, with examples and common pitfalls.

gostringstring-concatenation

Go Bitwise Shift Operators: Understanding << and >>

Learn how << and >> work in Go with simple examples, bit-level intuition, common mistakes, and practical use cases.

gobitwise-operators

Go Channels: Is It OK to Leave a Channel Open Forever?

Learn when Go channels need to be closed, when leaving them open is safe, and how request-reply channel patterns work in Go.

gochannel

Go Equivalent of __dirname: Getting the Current File or Working Directory in Golang

Learn the Go equivalent of Node.js __dirname, when to use runtime.Caller, and how to get the current working directory idiomatically.

go

Go Method Receiver Syntax Explained: Parentheses Before a Function Name

Learn what `(h handler)` and `(s *GracefulServer)` mean in Go function declarations and how method receivers work.

go

Page 1 of 6 - 112 questions

PreviousNext