Nestor,

On Mon, Jan 30, 2017 at 8:05 PM, Néstor Flórez <rot...@gmail.com> wrote:

> I am trying to learn Go and I do not understand why I am getting an error
> on line 15?
> Can someone tell me what is the problem.
>
> Thanks!!
>
> -----------
> package main
>
> import "fmt"
>
> func main() {
>   type say struct {
>     Name string
>     Power int
>   }
>   goku := say{"Goku", 9000}
>   Super(goku)
>   fmt.Println(goku.Power)
> }
>
> func Super(s say) { // line 15
>   s.Power += 10000
> }
>

you're defining the type "say" inside the function main.
so it's known only inside that scope.

try defining it ouside that function and see what gives.

hth,
-s

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