I'm learning Go ad I'm trying to build go file:
package main
import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"net/http"
)
func main() {
r := chi.NewRouter()
r.Use(middleware.Logger)
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("welcome"))
})
http.ListenAndServe(":3000", r)
}
But when I build the program with the command go build main.go
, it outputs:
go: github.com/go-chi/chi/@v1.5.4: missing go.sum entry; to add it:
go mod download github.com/go-chi/chi/
go.mod
:
module exprog
go 1.16
require github.com/go-chi/chi/ v1.5.4
when I execute go mod download github.com/go-chi/chi/
, I get this error:
go: github.com/go-chi/chi/@v1.5.4: malformed module path "github.com/go-chi/chi/": trailing slash
What I should do?