Well -- I was wrong. I got it backwards. There is a String() function is a receiver for *http.Cookie so it gets called when you need a string representation of a *http.Cookie (pointer to http.Cookie).
On Wed, Jun 14, 2017 at 1:18 PM, Aman Kapoor <aman.s...@gmail.com> wrote: > Hi Ayan, > > Thank you for pointing me to the right code. I saw there how string method > is creating the response. I think this is what I needed to see for my > question. Thank you. > > On Wednesday, 14 June 2017 22:28:55 UTC+5:30, Ayan George wrote: >> >> Hi Aman -- >> >> When you print *http.Cookie, Go does it's best to print each field >> knowing that it is a pointer to a struct. This is the format you end up >> with. >> >> But http.Cookie has a String() method associated with it that provides >> the output that you get when you simply print 'cookie' (without the >> asterisk). You can find the source for this by following the link below. >> >> https://golang.org/src/net/http/cookie.go?s=432:945#L138 >> >> This is AFAIK and I could be wrong. >> >> On Wed, Jun 14, 2017 at 11:24 AM, Aman Kapoor <aman...@gmail.com> wrote: >> >>> Hi, >>> >>> I was setting up cookies today. Go is my first web development language. >>> And, in my code (https://github.com/amankapoor >>> /basic-authentication-using-cookies), I outputted the cookie to command >>> line because I wanted to see how it looked there. >>> >>> I found that *cookie and cookie are returning answers in different >>> formats. Why so? >>> >>> >>> <https://lh3.googleusercontent.com/-xehgFZhq3m8/WUFS_diHQSI/AAAAAAAAXXo/y1kbRHMl5qAx1DcC6ClEF_5pIDsiRrc_wCLcBGAs/s1600/Capture1.JPG> >>> >>> -- >>> 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...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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. > -- 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.