Your cart is currently empty!
Golang: Importing Local Module
Create a new golang project
mkdir foo cd foo go mod init foo
Create a main.go
file
package main import "my-hello/english" func main() { english.Hello() }
We need to direct the module my-hello
to our local folder ../hello
folder where the go.mod
file resides.
go mod edit --replace my-hello=../hello go mod tidy
Then we try to run our program
-> % go run . Hello
To delete the module
go mod edit -dropreplace my-hello go mod tidy
References:
Leave a Reply