I\'ve used GOPATH but for this current issue I\'m facing it does not help. I want to be able to create packages that are specific to a project:
Create some files like this:
addition/aaa.go
bbb.go
The folder name will be one of your Module's packages. The file names can be whatever you want. Here is example package file:
package addition
func Add(n, n2 int) int {
return n + n2
}
and the Module file:
package main
import "arithmetic/addition"
func main() {
n := addition.Add(1, 2)
println(n)
}
Now initialize and build your module:
go mod init arithmetic
go build
https://golang.org/doc/code.html