Tutorial Issue: Can't import local package

707 views
Skip to first unread message

Brad Lindsay

unread,
Jun 13, 2010, 2:47:17 PM6/13/10
to golan...@googlegroups.com
I'm running through the Go tutorial, and I get an error I can't seem
to resolve in the IO Package section. When I go to compile the
helloworld3.go file, both my own and the included file in the progs
directory, I get the following error:

helloworld3.go:8: can't find import: ./file

It appears that I can't import local packages successfully.

I'm issuing the following command to compile it: 6g helloworld3.go

I'm running Mac OS X 10.6.3.


Am I doing something wrong? Is the tutorial out of date?

Thanks,
Brad

Brad Lindsay

unread,
Jun 13, 2010, 2:55:44 PM6/13/10
to golan...@googlegroups.com
Never mind. I got it working. I didn't realize I had to first compile
file.go (6g file.go) first before compiling and linking
helloworld3.go. As this is the first introduction to importing your
own local packages, I would suggest expanding the tutorial to include
directions on how to compile the file package and then helloworld3.

Feeling silly,
Brad

HaWe

unread,
Jun 13, 2010, 2:56:25 PM6/13/10
to golang-nuts
Compile file.go first. (That did it for me.)

rcha...@speakeasy.net

unread,
Jul 4, 2010, 12:40:25 PM7/4/10
to golang-nuts
Howdy,
Thanks for finding and posting that. You just unstuck me.

And to anyone with edit privilege on the tutorial, I strongly
second Brad Lindsay's suggestion of adding a sentence to the tutorial
about compiling file.go.

Thanks,
Ricky Charlet
Reply all
Reply to author
Forward
0 new messages