From 88b75b4791d7451bd183a8b5e2b0af1f2eda8c0d Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Wed, 4 Jan 2012 08:30:26 +0100 Subject: [PATCH] Unclear about type assertion in pointer example --- README | 4 ++-- cache.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index ae53ce7..eccb62e 100644 --- a/README +++ b/README @@ -61,13 +61,13 @@ Usage: c.Set("foo", foo, 0) ... x, _ := c.Get("foo") - foo := x.(MyStruct) + foo := x.(*MyStruct) fmt.Println(foo.Num) ... foo.Num++ ... x, _ := c.Get("foo") - foo := x.(MyStruct) + foo := x.(*MyStruct) foo.Println(foo.Num) // will print: diff --git a/cache.go b/cache.go index 04978df..e12eed3 100644 --- a/cache.go +++ b/cache.go @@ -72,13 +72,13 @@ import ( // c.Set("foo", foo, 0) // ... // x, _ := c.Get("foo") -// foo := x.(MyStruct) +// foo := x.(*MyStruct) // fmt.Println(foo.Num) // ... // foo.Num++ // ... // x, _ := c.Get("foo") -// foo := x.(MyStruct) +// foo := x.(*MyStruct) // foo.Println(foo.Num) // // will print: