Is there a way to have internal registries for Go like NPM has Verdaccio?

34 Views Asked by At

Although, this question is not related to nodejs, I am adding those fields, in case people familiar with handling NPM packages on private registries like Verdaccio can help guide or answer this question in a way which might be language agnostic.

From what I know, for private registries for TS/JS/Node, NPM will first query Verdaccio, which when then route to the public npm registry in case the package is not found.

What my issue is, that I feel package management in Go (Golang) is not as comprehensive as it is for NPM. Especially if you have packages on a private gitlab/github server, it becomes extremely messy, with a lot of configuration changes. There need to be code changes in a lot of cases, overall I have been struggling, and have wasted hours upon hours migrating code and fixing imports. I tried to find answers regarding this, but most of them just point to installing directly from Gitlab.

My question is, is there a way, where I can upload these packages to a private repository, which go get will refer to first and if it does not find a package there refer to the public repository instead? This problem becomes two-fold if for example I have to refer to different packages held in different private repositories on gitlab + github.

For example:

I want my code to look like:

import (
    "fmt"
    "log"
    "os"

    "github.com/joho/godotenv"
    mpp "myprivatepackage"
)

instead of

import (
    "fmt"
    "log"
    "os"

    "github.com/joho/godotenv"
    mpp "gitlab.com/myprivategitlab/myprivatepackage"
)

Thanks in advance!

0

There are 0 best solutions below