Skip to content
Gx
GitHub

GX3005: route package contents

A route package holds code other than route types.

Cause

A route package holds code other than route types. Each slice imports the route packages of the other slices, so a route package must not import a slice.

Example

shop/route/route.go
package route

import "github.com/alternayte/gx"

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

// Title is not a route type.
func Title() string { return "Shop" }

gx lint reports:

gx lint
shop/route/route.go:10:1: GX3005: route package holds a func; only route types are allowed

Fix

  1. Move the function or the variable into the slice package.
  2. Keep only route types and their Rules methods in the route package.