Skip to content
Gx
GitHub

GX3003: route value is not held by any gx.Collect

A page, an action or a form is declared and no gx.Collect call holds it.

Cause

A page, an action or a form is declared and no gx.Collect call holds it. The app does not serve a route that is not mounted.

Example

shop/HomeView.gx
package shop

<h1>Shop</h1>
shop/route/route.go
package route

import "github.com/alternayte/gx"

type Home struct {
	gx.Route `GET /{$}`
}
shop/shop.go
package shop

import (
	"github.com/alternayte/gx"
	"app/shop/route"
)

var HomePage = gx.Page(func(c *gx.Ctx, in route.Home) (HomeViewProps, error) {
	return HomeViewProps{}, nil
}, HomeView)

gx check reports:

gx check
shop/shop.go:8:5: GX3003: route value "HomePage" is not held by any gx.Collect

Fix

  1. Add the value to the gx.Collect call of its slice.
  2. Make sure that the list is in a Group call of the app.