Skip to content

E0207: Attribute on the wrong kind of declaration ​

An attribute type can say where it goes with @vuka.Targets(vuka.OnField | …), and decorators go on functions, methods and types. This one is on a declaration its target doesn't allow (a field attribute on a function, a decorator on a var).

Wrong ​

vuka
@vuka.Targets(vuka.OnField)
type Char struct{ Max int }

@Char{Max: 1}
func a() {}
vuka
@vuka.Targets(vuka.OnField)
type Char struct{ Max int }

type Post struct {
	Title string @Char{Max: 200}
}

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.