How Do You Troubleshoot the Go Programming Error ‘non-name m1[“foo”] on left side of :=’?

Problem scenario
You are running a Go program. You see this message about "command-line-arguments":

non-name m1["foo"] on left side of :=

What should you do?

Possible Solution
Can you try to use "=" instead of ":="? This may fix your problem.

The := is a variable declaration and an assignment. If your map has been declared, individual values in it should be assigned with an "=" (equals sign).

Leave a comment

Your email address will not be published. Required fields are marked *