We need to use GOPROXY and/or GOPRIVATE when working with private-only Go modules or a mix of private and public modules.
GOPROXY was introduced in version 1.3. It proxies Go modules from different version control systems (VCS) and caches them. Artifactory can be one such private proxy and GoProxy is the default public proxy.
Since in my day job I have to use Artifactory in different companies that's what I can describe.
Find out the name of the Go modules virtual repository that your instance of Artifactory uses. It could be something like go-virtual. Ask the administrators of your Artifactory instance.
Set the environment variable GOPROXY. Change the value according to your environment.
$ export GOPROXY=https://your.artifactory.tld/artifactory/api/go/your-go-virtual-repo
Now when you use
go get you should see the Artifactory proxy being used
go get -x).
$ go get -x github.com/antlr/antlr4/runtime/Go/antlr/v4
GOPRIVATE is used when you have some private modules and want to bypass the public proxy for them. For everything public you will use the proxy. I have written about it before in GitLab and go get.
I don't know if or how it will work but you could skip GOPRIVATE and only use a private GOPROXY on Artifactory that proxies your private git repositories.
If you use Python and PyPI, Artifactory can also proxy and cache PyPI. Ask your
administrators to configure it for you. Either use the
--extra-index-url flags in
pip to use it or you can set their corresponding
environment variables PIP_INDEX_URL and PIP_EXTRA_INDEX_URL.
Artifactory will need to be configured with a virtual repository pointing to PyPI which you will use by setting the environment variable. Notice /simple in the url.
$ export PIP_INDEX_URL=https://your.artifactory.tld/artifactory/api/pypi/your-pypi-virtual-repo/simple
Now when you use
pip it will use the Artifactory proxy/cache.
$ python3.11 -m pip install --user black or if you didn't set the environment variable $ python3.11 -m pip install --user --index-url https://your.artifactory.tld/artifactory/api/pypi/your-pypi-virtual-repo/simple black