CodeVetter · Repo Unpack · Extension points
gin-gonic/gin
Gin exposes extension seams through functions and small interfaces rather than a dynamic plugin loader in the inspected core. Middleware, route groups, binders, validators, renderers, codecs, and filesystem implementations provide distinct customization boundaries. Configuration includes both per-Engine options and process-global values. Compatibility constraints affect how new methods and build-tag variants should be introduced.
- HandlerFunc and HandlersChain are the middleware seam; RouterGroup.Use appends handlers, and combineHandlers copies group and route chains while enforcing the abort-index limit.
- OptionFunc receives an Engine, and With applies supplied functions in order; constructors accept these options for per-instance customization.
- Handle accepts custom uppercase methods, Match registers explicit method lists, and IQueryRoutes illustrates adding a capability without expanding the existing IRoutes interface.
- Custom Binding and BindingBody implementations plug into ShouldBindWith and ShouldBindBodyWith; BindingUri provides a separate map-based path-parameter contract.
- binding.Validator is replaceable through StructValidator, and the default validator's Engine exposes validator.Validate for registering custom field or struct validations.
- MapFormWithTag supports alternate mapping tags; BindUnmarshaler.UnmarshalParam and parser=encoding.TextUnmarshaler support custom form/query value conversion.
- json.API accepts a Core implementing marshal/unmarshal and decoder/encoder factories; documentation directs assignment before engine startup, and the default implementation wraps encoding/json.
- Custom Render and HTMLRender implementations, http.FileSystem values, LogFormatter/Skipper callbacks, and RecoveryFunc callbacks extend output, storage access, logging, and panic handling.