
Go Tricky Output Programs: Defer, Closures, Slices and nil
Go tricky output programs are short pieces of code where the printed result is not what most people expect. Interviewers love them because they…
Tag

Go tricky output programs are short pieces of code where the printed result is not what most people expect. Interviewers love them because they…

Go generics programs let you write one function or type that works for many types, such as int, float64 and string, without copying code.…

Go mutex programs protect shared data when many goroutines read and write it at the same time, and worker pools control how many goroutines…

Go channel programs let goroutines send values to each other safely, without shared variables or locks. Go’s motto is “do not communicate by sharing…

Go goroutine programs run several pieces of work at the same time, which is the feature Go is most famous for. A goroutine is…

Go JSON programs turn Go structs into JSON text and turn JSON text back into Go values, which is how almost every Go API…

Go file programs read, write and manage files on disk, such as saving a report, loading a config or counting lines in a log.…

Go date and time programs work with dates, clocks and durations, such as showing an order date, finding someone’s age or counting days until…

Go error handling programs show how Go reports and deals with problems, such as a missing file, bad input or a failed payment. Go…

Go interface programs let different types share behaviour, so one function can work with a circle, a rectangle or any shape you add later.…