On Sunday, 11 July 2021 at 10:21:53 UTC+1 Shulhan wrote: > Assuming that you are not enabling Go module, anything under > "$HOME/go/src/" directory will be considered as importable. >
But you really, really SHOULD be using module mode. You soon may not have any choice: https://blog.golang.org/go116-module-changes#TOC_2. (although that change is now not going to be made for 1.17) It's only one extra command to type: go mod init example.com/myprog (you can use whatever you like for the module name, if you're not planning on publishing it). That creates go.mod in the current directory. Then you can use import "example.com/myprog/foo" and it'll get the package from ./foo/ relative to where the go.mod file sits. Example: https://play.golang.org/p/YQoAu1Iwkor -- 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/3fc33f77-681d-4991-9310-558d8c143639n%40googlegroups.com.