Last active
December 16, 2019 20:58
-
-
Save benmezger/5116b160053a9456dae0a6935d22cd3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module bands-api | |
replace github.com/benmezger/bands-api => ./internal/ | |
go 1.13 | |
require github.com/go-chi/chi v4.0.2+incompatible // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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