What is the difference between the = and := operator?

Technology CommunityCategory: GolangWhat is the difference between the = and := operator?
VietMX Staff asked 3 years ago

In Go, := is for declaration + assignment, whereas = is for assignment only.

For example, var foo int = 10 is the same as foo := 10.