diff --git a/http/server.go b/http/server.go index bfbf8bc..32ede8c 100644 --- a/http/server.go +++ b/http/server.go @@ -71,7 +71,7 @@ func (rtr *router) updateSchema(schemas []types.Schema) { rtr.Lock() defer rtr.Unlock() router := httprouter.New() - for i := 0; i < len(schemas); i++ { + for i := range schemas { router.Handle(schemas[i].Method, schemas[i].Path, handlerFunc(schemas[i])) } rtr.Handler = router diff --git a/json/parser.go b/json/parser.go index 915b5ce..8ea3424 100644 --- a/json/parser.go +++ b/json/parser.go @@ -48,7 +48,7 @@ func (p *Parser) Watch(input chan io.Reader) { func createSchema(stubs []stub) ([]types.Schema, error) { schemas := make([]types.Schema, len(stubs)) - for i := 0; i < len(stubs); i++ { + for i := range stubs { if f := missingFields(stubs[i]); len(f) > 0 { err := fmt.Errorf("missing required fields: %s", strings.Join(f, ", ")) return []types.Schema{}, err