Context: We are using a monolithic repository architecture. This means we have one big github repo with many projects, each project using its own tech stack for ui, node, go, etc.
> /home/workspace/
> ./nodejs_project1
> ./reactui_project2
> ./reactnative_ui_project3
> ./go_identity_service_project4
> ./go_graphql_api_project5
> ./go_common (<--- how to share this with other go modules?)
>
> /home/go (GOPATH) - only for 3rd party vendor downloads fro go-get
> ./src
> ./bin
> ./pkg
In go_common we have common code used in all go projects such as logging, database connections, our schema/models as structs, etc. We are using Go 1.11 and declaring modules in go.mod. We also have this entire workspace and projects OUTSIDE our GOPATH. We do not want any vendor/3rd party downloaded modules inside our repo, similar to how we .gitignore node_modules in our node.js project. So go-get is downloading vendor modules to GOPATH src/pkg as expected and they are accessible to import to any go project.
However, we cannot get imports references go_common's module to work. We tried doing go build and go install in go_common, which created a binary in GOPATH/bin, but that didn't help actually make it reference-able. Is there a standard way to do this, especially now that Go 1.11 and vgo integrated is suppose to not rely on GOPATH and make module management easier... ??