I'm extending an existing database driver (https://github.com/MonetDB/MonetDB-Go).
I use the github url as an import in my main.go
, and in the go.mod
:
replace github.com/fajran/go-monetdb@latest => github.com/MonetDB/MonetDB-Go v1.0.0
Yet when I try to go get
/go install
/go run
it, it says:
main.go:7:2: no required module provides package github.com/MonetDB/MonetDB-Go; to add it:
go get github.com/MonetDB/MonetDB-Go
Am I doing something wrong, or is it because it's a fork?
You don't need to replace anything, since you already import github.com/MonetDB/MonetDB-Go
.
Your error comes from the fact that the source code in github.com/MonetDB/MonetDB-Go
is under the src
directory.
Final go.mod
file:
module example
go 1.16
require github.com/MonetDB/MonetDB-Go v1.0.0
Final main.go
:
package main
import (
"fmt"
"github.com/MonetDB/MonetDB-Go/src"
)
func main() {
fmt.Println(monetdb.MAPI_STATE_INIT) // prints 0
}