GX3001: pattern variable has no field
The route pattern has a variable and the route type has no field for it.
Cause
The route pattern has a variable and the route type has no field for it. A variable binds to the field with the same name; upper and lower case are equal.
Example
package route
import "github.com/alternayte/gx"
type Show struct {
gx.Route `GET /products/{id}`
}gx check reports:
shop/route/route.go:5:6: GX3001: pattern variable "id" has no field in "Show"Fix
- Add a field with the name of the variable.
- Or add a
path:"name"tag to the field that takes the value.