Skip to content

E0421: Two context processors give one variable ​

Each exported field of a context processor's result is a template variable, named after the field in lower camel case: Me is me. Two processors in main's web.ContextProcessors(…) giving the same name — or one processor listed twice — would leave a template's me meaning either, so the build fails, naming both processors and where they are declared. Reported by the compiler, by vuka vet and at boot.

Wrong ​

go
// users/context.go
type Vars struct{ Me *User }

// admin/context.go
type Vars struct{ Me *Staff }

web.ContextProcessors(users.Context, admin.Context)
go
// admin/context.go
type Vars struct{ Staff *Staff }

web.ContextProcessors(users.Context, admin.Context)

See context processors.

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.