Skip to content

W0401: A name shadowing a context processor variable ​

A shape's field or a local its markup declares has the name of a context processor variable. As in Go, the nearer name wins: the template reads the field, not the variable. That is how a caller passes a value of its own, so it works; the warning says the variable isn't what is read there. Reported by vuka vet.

Wrong ​

html
<script lang="go">
type Badge struct {
	user string // the variable user is the signed-in user
}
</script>

<b>{user}</b>
html
<script lang="go">
type Badge struct {
	label string
}
</script>

<b>{label} {user.Name}</b>

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.