
Go Time: Golang, Software Engineering The bits of Go we avoid (and why)
13 snips
Mar 16, 2023 A lively tour of Go features the panel tends to leave on the shelf, from full slice expressions, naked returns, panics, and labels to global state, init functions, and internal packages. They debate when explicit code beats clever syntax, share personal coding pet peeves, and detour into robots, password managers, and keeping keyboards clean.
AI Snips
Chapters
Transcript
Episode notes
Avoid "new"
- Avoid using the
newkeyword in Go. - Use struct literals for instantiation, as it's consistent and readable, even without setting fields.
Generic Zero Values with "new"
new(T)is mainly useful in generic Go code.- It helps return the zero value of a generic type T when a direct zero value expression isn't available.
Avoid Full Slice Expressions
- Avoid full slice expressions (with a third index for capacity).
- Their behavior isn't intuitive and may confuse readers; use
slices.clipfor clarity.
