I am planning to do some program analysis on Golang, just like pylint, trying to find issues from source code. So the first question I need to ask is:
What are the common pitfalls specialized in the Go language?
I know there are some ones in Python, e.g. array variables '[]' as parameters, and mutable vs immutable objects. (See more here and there).
Example 1:
>>> def spam(eggs=[]):
... eggs.append("spam")
... return eggs
...
>>> spam()
['spam']
>>> spam()
['spam', 'spam']
>>> spam()
['spam', 'spam', 'spam']
>>> spam()
['spam', 'spam', 'spam', 'spam']
Example 2:
Map<Person, String> map = ...
Person p = new Person();
map.put(p, "Hey, there!");
p.setName("Daniel");
map.get(p); // => null
So what I really want to know is the similar ones in Golang. I have search the web but cannot find it. I also review some git repository history (e.g. docker.io) but cannot get typical ones. Could you kindly provide me some examples such as memory leaks, concurrency, unexpected results, and misunderstandings.