Function returns lock by value
<p>I have the following structure</p>
<pre><code>    type Groups struct {
        sync.Mutex
        Names []string
    }
</code></pre>
<p>and the following function</p>
<pre class="lang-golang prettyprint-override"><code>    func NewGroups(names ...string) (Groups, error) {
        // ...
        return groups, nil
    }
</code></pre>
<p>When I check for semantic errors with <code>go vet</code>, I am getting this warning:</p>
<blockquote>
<p>NewGroups returns Lock by value: Groups</p>
</blockquote>
<p>As <code>go vet</code> is shouting, it is not good. What problems can this code bring? How can I fix this?</p>