DEV Community


Discussion on: Variable Declarations in Go

citizen428 profile image
Michael Kohl • Edited

This is a good read on the topic from Go Design Patterns: = vs :=

forstmeier profile image
John Forstmeier Author

I like that piece particularly this bit at the end:

In general, short variable declarations should be preferred because they are more concise than regular variable declarations/assignments.

I tend to agree with that sentiment given that := is only available inside a function, which seems to indicate it is the preferred method. var is still an option which is my primary hangup.