MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / matchGo122MethodPattern

Function matchGo122MethodPattern

src/resolution/frameworks/go.ts:175–179  ·  view source on GitHub ↗

* Go 1.22 net/http mux patterns: `mux.HandleFunc("GET /users/{id}", h)`. * Returns the HTTP method when the pattern starts with one, null otherwise. * Only Handle/HandleFunc take these — Gin/Chi verb methods take a bare path.

(routePath: string, rawMethod: string)

Source from the content-addressed store, hash-verified

173 * Only Handle/HandleFunc take these — Gin/Chi verb methods take a bare path.
174 */
175function matchGo122MethodPattern(routePath: string, rawMethod: string): string | null {
176 if (rawMethod !== 'Handle' && rawMethod !== 'HandleFunc') return null;
177 const m = routePath.match(/^(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|CONNECT|TRACE)\s+\S/);
178 return m ? m[1]! : null;
179}
180
181/** Extract the last identifier from an expression like `pkg.Sub.handler` or `handler`. */
182function extractGoTailIdent(expr: string): string | null {

Callers 1

extractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected