Api Versioning (ARCH5202)
Key go.quality.api-versioning · Severity info · Category quality
Unversioned API paths make it impossible to ship breaking changes without breaking existing clients. Add an explicit version segment to the path.
Incorrect
Section titled “Incorrect”func registerRoutes(r *http.ServeMux) { r.HandleFunc("/users", listUsers) r.HandleFunc("/orders", listOrders)}Correct
Section titled “Correct”func registerRoutes(r *http.ServeMux) { r.HandleFunc("/v1/users", listUsers) r.HandleFunc("/v1/orders", listOrders)}Add an explicit version segment such as /v1 to route groups.