gogiteagoinstall

how to `go install` from gitea


I'm trying to install a package from a self-hosted gitea instance. I'm trying to get a package running go install gitea.urkob.com/urko/go-root-dir but I'm getting this error

no required module provides package gitea.urkob.com/urko/go-root-dir; to add it:
        go get gitea.urkob.com/urko/go-root-dir

Any help would be appreciated to show me how can I configure my go env.

I've set GOPRIVATE="gitea.urkob.com/urko" but it still not working, I don't know if I'm missing something.


Solution

  • go install is used to install a binary, not a package.

    Whereas in your case, gitea.urkob.com/urko/go-root-dir is only a package, because when I tried with go get, I'm getting:

    $ go get -v gitea.urkob.com/urko/go-root-dir
    get "gitea.urkob.com/urko/go-root-dir": found meta tag vcs.metaImport{Prefix:"gitea.urkob.com/urko/go-root-dir", VCS:"git", RepoRoot:"https://gitea.urkob.com/urko/go-root-dir.git"} at //gitea.urkob.com/urko/go-root-dir?go-get=1
    gitea.urkob.com/urko/go-root-dir (download)
    gitea.urkob.com/urko/go-root-dir
    # gitea.urkob.com/urko/go-root-dir
    runtime.main_main·f: function main is undeclared in the main package
    

    If you meant it to be a binary, then put/specify a main function for it.