E0401: A route is declared twice
Two handlers declare the same method and path, so a request can't tell them apart. Both places are shown. Reported at boot, and by vukavet.
Wrong
vuka
@web.Get("/pets")
func ListPets(store *PetStore) []Pet { … }
@web.Get("/pets")
func AdminPets(store *PetStore) []Pet { … }go
func init() {
web.Routes.Get("/pets", ListPets)
web.Routes.Get("/pets", AdminPets)
}Right
vuka
@web.Get("/pets")
func ListPets(store *PetStore) []Pet { … }
@web.Get("/admin/pets")
func AdminPets(store *PetStore) []Pet { … }go
func init() {
web.Routes.Get("/pets", ListPets)
web.Routes.Get("/admin/pets", AdminPets)
}