Closed
Description
In this code:
package main
import (
"encoding/json"
"errors"
"fmt"
)
type MyType struct {
Err string
Error error `json:"-"`
}
func (m MyType) MarshalJSON() ([]byte, error) {
type t MyType
out := t(m)
if out.Error != nil { // out.Error marked as unresolved reference
out.Err = out.Error.Error() // here both out.Err and out.Error are unresolved references
}
return json.Marshal(out)
}
func main() {
e := MyType{
Err: "hello",
}
e.Error = errors.New("bad error")
out, _ := json.Marshal(e)
fmt.Printf("Output: %s", string(out))
}
IDEA: 15.x
Plugin: 0.10.859 and many previous versions