Thanks, guys!

So, just for me to be clear, the line me.Set("It works!") in my original 
code created a copy of the "me" fetcher, set its names field, and then 
threw it away, leaving the original "me.name" with an unaltered, empty 
string value?


On Tuesday, September 13, 2016 at 2:41:46 PM UTC-4, Frank Davidson wrote:
>
> I think I'm having some type of mental lapse, but can anyone tell me why 
> this doesn't print out "It works!" nor give me an error? It simply prints 
> an empty string...
>
> https://play.golang.org/p/9oG0S8kfM3
>
> package main
>
> import "fmt"
>
> type fetcher struct { names string }
>
> func (f fetcher) Set(tname string) {
> f.names = tname
> }
>
> func main() {
> var me fetcher
> me.Set("It works!")
> fmt.Println(me.names)
> }
>

-- 
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