Have found the cause of the issue

The message that I was trying to marshall had *0x10a3c2d0 (when 
fmt.Println)  *which was http response.

>From  https://github.com/revel/revel/issues/1037 i found that

*Since Go 1.6 http.Request struct contains `Cancel <-chan struct{}` which*
*results in `json: unsupported type: <-chan struct {}`*

So i created struct for httpRes instaed of using interface . 

*type HttpRespStruct struct {*
* Status string*
* StatusCode int*
* Proto string*
* Header http.Header *
* ContentLength int64*
* TransferEncoding []string*
*}*
and it fixed the issue.

One thing i wanted to ask

When i return http response from a function should i use
*func makeCalls() (string, error, *http.Response, error) *
or
*func makeCalls() (string, error, http.Response, error)  *

For the struct i created above what should be the type of header should it 
be **http.Header  or **http.Header ??*

Thank You.

On Thursday, June 16, 2016 at 3:14:00 PM UTC+5:30, User123 wrote:

> The data  I am trying to marshal contains serialized data. This data is 
> received in http response.
>
> It works perfectly when I try in version 1.4.1/ 1.4.2.
>
> But when I try this to the latest version 1.6 it gives an error: *json: 
> unsupported type: <-chan struct {}*
>
> Why is it so? 
>
> I am not able to upgrade to the latest version because of this.
>
> Please help!
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to