Skip to content

E0428: Context processors that need each other ​

A package that reads a processor's variables by name is compiled after the processor's package, so the variables' types are known. Here that order can't be kept: the processor's package needs the package compiled first, through the variables another package reads by name. The message names the package, the processor and the packages between them; it is reported at the processor's entry in web.ContextProcessors(…). Reported by the compiler.

A processor's own imports never read its variables by name — that would be an import cycle — and they don't get them: a package nav.Context's package imports can't use badges, while the pages can.

Wrong ​

go
// main.go
web.ContextProcessors(orders.Context, users.Context)

// orders/context.go imports reports; reports/totals.vuka reads me
//   (users.Context's)
// users/context.go imports views; views/header.vuka reads cart
//   (orders.Context's)

views waits for orders, which imports reports, which waits for users, which imports views.

go
// users/context.go imports what it needed of views from a package
// that reads no processor variable by name: users/model, say

A processor's package should import models and services, not the packages that render. 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.