On 2012/9/23 RoboTamer <
grue...@gmail.com> wrote:
> I get this error and can't figure out why.
> The error happens in func main.
> I have recreated what I am trying to accomplish at golang play and it works
> fine.
> However in my actual code the List struct is in a separate package called
> jgdb
> So the only difference I can see between my actual code, which I have
> included below and the play code is that I am assigning it like this: DBM
> *jgdb.List because it is a separate package.
>
> Somehow var DBM does not retain it's data from one function to the other.
> It works fine if I put all the code in to func main, but as soon as I use a
> second function it gives me this error.
> In the code below the value of DBM in main is nil
>
> I been on this for hours now, maybe you can give me a pointer, what am I
> possibly doing wrong here?
The ":=" operator declares local variables. So init() is working with
a different variable than your global variable. Use "=" to assign