Http Action Naming (ARCH5004)
Ce contenu n’est pas encore disponible dans votre langue.
Key go.naming.route-handler-naming · Severity info · Category naming
Web framework route handler names should match their HTTP verb semantics (GET→get/list, POST→create) for RESTful consistency. Misleading handler names hide intent from readers.
Incorrect
Section titled “Incorrect”// POST /usersfunc DeleteUser(w http.ResponseWriter, r *http.Request) { createUser(r)}Correct
Section titled “Correct”// POST /usersfunc CreateUser(w http.ResponseWriter, r *http.Request) { createUser(r)}Rename the handler to match the actual HTTP verb (Create for POST, Get/List for GET).