Skip to content

W0101: A bare name is a field and a name of the package ​

A file-based template reads its type's fields and methods by bare name, and a field or method wins over a function or variable of the package spelt the same. This name is both, so the template reads the field, which may not be what was meant. Reported by vukavet.

Wrong ​

go
type Card struct{ Title string }

func Title() string { return "Orders" }
html
<!-- card.vuka.html -->
<h2>{Title}</h2>
html
<!-- card.vuka.html -->
func (c Card) View()
<h2>{c.Title}</h2>

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.