Go json Unmarshaller is not called

前端 未结 2 875
生来不讨喜
生来不讨喜 2021-01-23 18:14

I\'m fairly new to Golang. And I was looking for a way to do some custom stuff for marshaling and unmarshalling json. I have found the solution to implement M

2条回答
  •  醉梦人生
    2021-01-23 18:45

    Data methods has value receiver, but the variable data has pointer type (*Data).

    Pointer type variables cannot use functions with value receiver. Either change variable type or receiver type.

    Also see https://github.com/golang/go/wiki/CodeReviewComments#receiver-type about receivers.

提交回复
热议问题