Skip to content
Gx
GitHub

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

shop/route/route.go
package route

import "github.com/alternayte/gx"

type Show struct {
	gx.Route `GET /products`
	ID       int64 `path:"id"`
}

gx check reports:

gx check
shop/route/route.go:7:2: GX3002: field "ID" binds path "id" which the pattern has no variable for

Fix

  1. Add the variable to the pattern, for example GET /products/{id}.
  2. Or remove the path tag.