A very simple web server used to provide go mod with the location of your private Go module. This is useful when your private Go modules are accessed via non-standard ports.
|
1 year ago | |
---|---|---|
internal | 1 year ago | |
pages | 1 year ago | |
.gitignore | 1 year ago | |
LICENSE | 1 year ago | |
go.mod | 1 year ago | |
go.sum | 1 year ago | |
main.go | 1 year ago | |
readme.md | 1 year ago |
This is a very simple web server used to provide go mod
with the location of your private Go module. This
is useful when your private Go modules are accessed via non-standard ports.
main.go
with go build -o locatorServer main.go
.locatorServer
with the site hostname
, access port
and repoLocation
.
hostname
needs to be the same as in your go module./etc/hosts
.repoLocation
is where you will be pulling your Go module from via git. Example, if all your Go module repos
are named go_module_<module_name>
, you can set this to ssh://git@company.com/team/go_module_
.http
, you will need to set the GOINSECURE
environment variable for your domain. Ex GOINSECURE=mycooldomain.com
.GOPRIVATE
environment variable to avoid sum checks.Once running, when go wants to access one of your private Go modules, example
import (
myModule "mycooldomain.com/my_module"
)
go will send a GET request to https://mycooldomain.com/my_module
and the server will tell go mod to git pull the repo
from <repoLocation><module_name>
, i.e. ssh://git@company.com/team/go_module_my_module
.