I have created local packages in support of my main golang program; it has 
been challenging to figure out where to put these packages and how to 
import them.  Obviously this area of Go has changed over the years so some 
examples out there are just wrong.  I got things working but can find no 
info on why, so my question is where is an explaination of how / why the 
below works (specifically using "main" prefix):

go version go1.16.5 darwin/amd64
Using Visual Studio Code v 1.58.0 on MacOS

*~/go/src/myproject/main.go*
package main

import "main/mypackage"

func main() { 
    mypackage.Dothis()
}
---

*~/go/src/myproject/mypackage/mypackage.go*
package mypackage

func Dothis() { }


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2f031dbd-e33b-460b-8acc-234119521877n%40googlegroups.com.

Reply via email to