I’m getting this error in the code
cannot use r (variable of type *"vendor/github.com/gorilla/mux".Router) as *"github.com/gorilla/mux".Router value in argument to routes.RegisterBookStoreRoutes
func main() {
r := mux.NewRouter()
routes.RegisterBookStoreRoutes(r)
http.Handle("/", r)
log.Fatal(http.ListenAndServe("localhost:8010", r))
}
This is my Import clause, it doesn’t have vendor/ in it.
import (
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/shetaanshu/go-bookstore/pkg/routes"
)
how to debug the error?
You seem to be importing gorilla mux with vendor prefix.
Do not put “vendor/” in the import path of the package in the
import
clause. An import path is not a path on the filesystem. Packages under thevendor/
folder are picked up by thego
tooling automatically.