Go get using a fork

Currently I’m extending an unmaintained database driver in Go (https://github.com/MonetDB/MonetDB-Go). I’ve forked the repo, and now want to test it in a test app.

I’ve imported it in my main.go, then in my go.mod I’m using replace to point to my fork:
replace <old-repo>@latest => <new-repo> v1.0.0.

Yet when I try to go get/go install/go run I always get the same warning:

main.go:7:2: no required module provides package github.com/MonetDB/MonetDB-Go; to add it:
    go get github.com/MonetDB/MonetDB-Go

I’m aware that I cannot go get a fork, so I’m using replace.
Am I doing something wrong in the go.mod in the fork?

generally, you have two ways:

  1. in your fork, in go.mod file, change a header line to <new repo>
  2. you can use replace directive in a following way:
go mod edit --replace <old repo> = <new repo>@latest`
go mod tidy

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.