go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.57k stars 574 forks source link

Missing quickfix AssignmentToReceiverInspection #2610

Open dlsniper opened 8 years ago

dlsniper commented 8 years ago

The inspection reports Assignment to method receiver doesn't propagate to other calls or Assignment to method receiver propagates only to callees but not to callers but there's no good way that I can think of to solve this. Suggestions are welcomed.

daliborfilus commented 8 years ago

Hi. If I have the following and it raises inspection warning "Assignment to method receiver propagates only to callees but not to callers":

type Test struct {}
func (t *Test) Modify() {
    (*t) = Test{}
}

what's wrong with that? I don't fully understand the meaning of the inspection message in this case.

In go, we need to assign to pointer receiver, in cases such as UnmarshalText(), UnmarshalXML() etc., how else we could achieve the same result?

What am I missing?