Questions

Go questions

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

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

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 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

Difference Between := and = in Go

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

go

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 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

Go Pointers vs Values in Parameters and Return Values

Learn when to use structs, pointers, slices, and pointer receivers in Go parameters and return values with practical rules and examples.

gopointers

Go Ternary Operator Equivalent: Idiomatic Conditional Assignment in Go

Learn the idiomatic Go alternative to C's ternary operator and how to write clear conditional assignment with if statements.

goternary-operatorconditional-operator

Go foreach Loop: How to Iterate with for range in Go

Learn how Go handles foreach-style iteration using for range to loop over slices, arrays, maps, strings, and channels.

goforeachslice

How Go Fetches Private GitHub Repositories and Fixes "terminal prompts disabled"

Learn why `go get` fails on private GitHub repos with "terminal prompts disabled" and how to configure Go and Git correctly.

gogit

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 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 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

Page 1 of 2 - 32 questions

PreviousNext