Analyzer::Go::GoRestful
Inherits Analyzer::Go::GoEngine < Analyzer < FileHelper < Reference < Object
go-restful (github.com/emicklei/go-restful) — a WebService-centric
router used across the cloud-native ecosystem (Kubernetes' apiserver,
Harbor, …). Routes are a nested builder chain hung off a WebService
whose Path() supplies the prefix:
ws := new(restful.WebService) ws.Path("/users") ws.Route(ws.GET("/{user-id}").To(u.findUser). Param(ws.PathParameter("user-id", "identifier")). Reads(User{}))
The extractor resolves the full mounted path and the self-declared params; this analyzer wires endpoints, params, and 1-hop callees.
Constants
One precompiled matcher instead of a String#includes? scan per
.go file: includes? runs Rabin-Karp over the whole buffer and
the marker is absent in the overwhelming majority of files in a
polyglot repo, so every one of them pays the full scan. See
Analyzer#content_matches?.
Class methods
Instance methods
go-restful path params are {name}, with an optional tail/regex
constraint {name:*} / {name:[0-9]+}; strip the constraint so the
template reads as a clean {name} (mirrors the Iris normalizer).
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.