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:
myproject/
├── binary1.go
├── binary2.go
├── package1.go
└── package2.go
I tried multiple ways but how do I get package1.go
to work in the binary1.go
or the binary2.go
and so on?
For example; I want to be able to import "package1"
and then be able to run go build binary1.go
and everything works fine without the error being thrown that the package cannot be found on GOROOT
or GOPATH
. The reason why I need this kind of functionality is for large scale projects; I do not want to have to reference multiple other packages or keep them in one large file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…