Questions

Go questions

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

How to Check for an Empty String in Go

Learn the idiomatic way to test empty and non-empty strings in Go, with examples, comparisons, mistakes, and practical usage.

gostringis-empty

How to Check if a Map Contains a Key in Go

Learn how to test whether a key exists in a Go map using the idiomatic comma-ok pattern, with examples and common mistakes.

godictionarygo-map

How to Compare Two Slices for Equality in Go

Learn how to check whether two slices are equal in Go, why == does not work, and how to compare slice contents safely.

gocomparisonslice

How to Convert an int to a String in Go

Learn how to convert an int to a string in Go using strconv.Itoa and FormatInt, and why string(i) gives a character instead of digits.

gostringintegerconverters

How to Delete a Key from a Map in Go

Learn how to remove entries from a Go map using delete(), with examples, common mistakes, and practical map usage patterns.

godictionary

How to Delete an Element from a Slice in Go

Learn how to delete an element from a slice in Go using append, slicing, and index checks with simple examples and common mistakes.

goslice

How to Find the Type of an Object in Go

Learn how to inspect variable types in Go using reflect.TypeOf, %T, and type assertions with clear examples for beginners.

gogo-reflect

How to Format a String in Go Without Printing

Learn how to format and return strings in Go using fmt.Sprintf, with examples, comparisons, common mistakes, and a mini project.

gostringformattingstring-formatting

How to Generate a Random String of Fixed Length in Go

Learn how to generate fixed-length random letter strings in Go using simple, fast, and beginner-friendly techniques.

gostringrandom

How to Get a Slice of Map Keys in Go

Learn how to collect map keys into a slice in Go, why iteration is required, and common patterns for sorting and using keys safely.

godictionaryslice

How to Handle Configuration in Go

Learn practical ways to handle configuration in Go using flags, environment variables, and config files with clear examples and patterns.

goconfiguration-files

How to Handle JSON POST Requests in Go

Learn the correct way to read and decode JSON POST request bodies in Go using net/http and encoding/json.

gojson

How to Handle Unused Variables and Imports in Go

Learn why Go reports unused variables and imports, how to fix them, and practical ways to work efficiently while developing Go code.

go

How to Initialize an Empty Slice in Go

Learn the correct way to initialize an empty slice in Go using make([]T, 0) or []T{}, with examples, differences, and best practices.

goarraysslice

How to Iterate Over Map Keys in Go

Learn how to get and iterate over all keys in a Go map using range, with examples, common mistakes, and practical patterns.

goloopsdictionary

How to Iterate Over a Range of Integers in Go

Learn how to loop over integer ranges in Go, why range does not work like Ruby, and practical patterns for counting with for loops.

goloopsintegerrange

How to List a Directory in Go

Learn how to list files and folders in a single directory in Go using os.ReadDir, with examples, common mistakes, and practical patterns.

go

How to Multiply time.Duration by an Integer in Go

Learn why multiplying rand.Int31n() by time.Millisecond fails in Go and how to correctly work with time.Duration values.

gotime

How to Pretty-Print JSON in Go

Learn how to pretty-print JSON in Go using json.MarshalIndent and json.Indent, with examples, mistakes, and practical usage.

gojsonpretty-print

How to Print Struct Variables in Go

Learn how to print struct fields in Go using fmt.Println, fmt.Printf, and formatting verbs with practical examples for beginners.

gostruct

Page 2 of 4 - 62 questions