Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Cunningham
3,510 PointsImport is Different
the import for a self-made package only works on my computer if I give "./[package path]". If I give "[package path]", like in the demonstration, it doesn't. Why is this? The paths I'm experimenting with don't have the package main file in a src/ folder, if that matters.
1 Answer
Steven Parker
231,275 PointsYou may not have configured the GOPATH
.
When a file name is given without an explicit path (no slash "/" in it), the system will search folders that have been configured in the system environment variable "GOPATH
". If files in the current folder are not being found, that probably means that GOPATH
has not been configured or it does not include the current folder.
To learn more about the GOPATH
environment variable, see this document page or 'go help gopath'.
David Cunningham
3,510 PointsDavid Cunningham
3,510 PointsThanks!