GX3002: path field has no pattern variable
A field has a path tag and the route pattern has no variable with that name.
Cause
A field has a path tag and the route pattern has no variable with that name.
Example
package route
import "github.com/alternayte/gx"
type Show struct {
gx.Route `GET /products`
ID int64 `path:"id"`
}gx check reports:
shop/route/route.go:7:2: GX3002: field "ID" binds path "id" which the pattern has no variable forFix
- Add the variable to the pattern, for example
GET /products/{id}. - Or remove the
pathtag.