Skip to content
Gx
GitHub

GX3000: route field type cannot bind

A route input field has a type that Gx cannot fill from a request.

Cause

A route input field has a type that Gx cannot fill from a request. Gx fills strings, numbers, booleans, files, structs of these and slices of these.

Example

shop/route/route.go
package route

import "github.com/alternayte/gx"

type List struct {
	gx.Route `GET /products`
	Filter   map[string]string `query:"filter"`
}

gx check reports:

gx check
shop/route/route.go:7:2: GX3000: field "Filter" has type "map[string]string" which cannot bind

Fix

  1. Change the field to a type that Gx can fill.
  2. Or remove the field and read the value in the handler.