Skip to content

bug: analyze kind=routes mixes fields — line is the mux registration line but file is the handler's file (Go net/http 1.22 method patterns) #322

Description

@tiendungdev

Env: gortex daemon vv0.61.0+58dc39b, Windows 11 Pro, Go repo using net/http 1.22 method patterns, MCP facade v1.

Repro shape

Package with the registration and the handlers in different files:

// handler.go
func (h handlers) Register(mux *http.ServeMux) {
    ...
    mux.HandleFunc("POST /api/admin/things/{id}/request-update", h.requestUpdate) // handler.go:166
}

// actions.go
// requestUpdate handles POST /api/admin/things/{id}/request-update.
func (h handlers) requestUpdate(w http.ResponseWriter, r *http.Request) { ... } // actions.go:~200

analyze {kind:"routes"} returns:

file:    .../actions.go        <-- handler's file
line:    166                   <-- registration line, which is in handler.go
handler: .../actions.go::handlers.requestUpdate
method:  POST
path:    /api/admin/things/{id}/request-update

Verified with git grep: actions.go:166 is unrelated code inside another handler's body; the literal registration lives at handler.go:166. Method/path/handler symbol are all correct — only the file+line pair is incoherent, so consumers who cite file:line point at the wrong place.

Expected

file:line should describe one site consistently (the registration site), or the row should carry both explicitly, e.g. route_file:route_line + handler_file:handler_line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions