Skip to content

Instantly share code, notes, and snippets.

@benmezger
Last active December 16, 2019 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmezger/5116b160053a9456dae0a6935d22cd3a to your computer and use it in GitHub Desktop.
Save benmezger/5116b160053a9456dae0a6935d22cd3a to your computer and use it in GitHub Desktop.
$ go build ./internal/bands
internal/bands/bands.go:5:2: module github.com/go-chi/chi@latest found (v4.0.2+incompatible), but does not contain package github.com/go-chi/chi/render
internal/bands/bands.go:6:2: malformed module path "internal/io": missing dot in first path element
module bands-api
replace github.com/benmezger/bands-api => ./internal/
go 1.13
require github.com/go-chi/chi v4.0.2+incompatible // indirect
package main
import (
"./internal/bands"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"net/http"
)
func BaseRoutes() *chi.Mux {
router := chi.NewRouter()
router.Use(
middleware.RequestID,
middleware.RealIP,
middleware.RedirectSlashes,
middleware.Logger,
middleware.Recoverer,
)
return router
}
func main() {
router := BaseRoutes()
router.Route("/v1", func(r chi.Router) {
r.Mount("/api/artists", bands.Routes())
})
http.ListenAndServe(":8080", router)
}
$ go build cmd/main.go 130 ↵ ᚴ upstream ! master 5A
cmd/main.go:4:2: cannot find package "." in:
/Users/benmezger/workspace/bands/src/cmd/internal/bands
workspace/bands/src ∙ tree 1 ↵ ᚴ upstream ! master 5A
.
├── cmd
│   └── main.go
└── internal
├── bands
│   └── bands.go
├── data
│   └── types.go
├── internal.go
└── io
└── io.go
5 directories, 5 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment