GX4002: more than one action is registered for a route type
Two gx.Action calls handle the same route type.
Cause
Two gx.Action calls handle the same route type. The message gives the two positions.
Example
package cart
import "app/cart/route"
<button on:click={route.Add{}}>Add</button>package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })
var AddAgain = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `POST /cart/add`
}gx check reports:
cart/Button.gx:5:9: GX4002: "Add" is registered 2 times: cart/cart.go:8:11, cart/cart.go:10:16Fix
- Remove one of the two calls.
- Or give the second action its own route type.