Skip to content
Gx
GitHub

GX3006: route field has the name of a generated method

A route input field has the same name as a method that Gx generates for the route type.

Cause

A route input field has the same name as a method that Gx generates for the route type. The generated file holds methods such as Pattern, URL, Bind, GxFormValue and GxTool. A field and a method cannot have the same name on one type, so the generated code does not compile.

Example

shop/route/route.go
package route

import "github.com/alternayte/gx"

type AddRSS struct {
	gx.Route `POST /sources/add`
	URL      string
}

gx check reports:

gx check
shop/route/route.go:7:2: GX3006: field "URL" has the name of a method that gx generates for "AddRSS"

Fix

  1. Rename the field, for example to Address.