Questions

Go questions

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

How to Add Methods to Existing Types in Go

Learn why Go prevents adding methods to non-local types and how to extend existing types using wrapper types and helper functions.

goextension-methods

How to Assign a String to a Byte Array in Go

Learn how to copy a string into a fixed-size byte array in Go, with examples, pitfalls, and practical patterns for safe conversion.

go

How to Check If a File Exists in Go

Learn the idiomatic way to check whether a file exists in Go using os.Stat, errors.Is, and proper error handling patterns.

gofilestandard-library

How to Check Whether a Slice Contains a Value in Go

Learn how to check if a slice contains a value in Go, when linear search is required, and when to use maps instead of slices.

goslice

How to Check Whether a String Contains a Substring in Go

Learn how to test whether a string contains a substring in Go using strings.Contains with clear examples and common mistakes.

gosubstring

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 Structs, Slices, and Maps for Equality in Go

Learn how equality works for structs, slices, and maps in Go, including why `==` fails and when to use `reflect.DeepEqual`.

gogo-reflect

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 a Unix Timestamp to time.Time in Go

Learn how to convert Unix timestamps to time.Time in Go using time.Unix, why time.Parse fails, and common mistakes to avoid.

gotimeunix-timestamp

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 Convert float64 to int in Go

Learn how to convert float64 to int in Go using type conversion, truncation rules, examples, mistakes, and practical use cases.

go

How to Create and Import Custom Packages in Go

Learn how Go packages, folders, and modules work so you can create a custom package and import it correctly in a Go program.

goimportpackage

How to Declare a Constant Array or Slice in Go

Learn how to declare fixed data in Go, why const arrays are not allowed, and how to use arrays, slices, and variables correctly.

goarraysconstants

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 Disable or Bypass go test Caching in Go

Learn how go test caching works in Go and how to force tests to run again using practical commands and examples.

gotesting

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 Time in Go Using yyyyMMddHHmmss

Learn how to format the current time in Go as yyyyMMddHHmmss using Go's reference time layout with clear examples and common mistakes.

gotimeformattimestamp

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

Page 4 of 9 - 162 questions