Skip to content

E0142: A template file has no package clause, or another package's ​

A .vuka.html file starts with its package clause, as a Go file does: the package of its directory (or of the directory's external test package, layouts_test, for that package's templates). Comments may come before it; imports, the main markup and the func templates follow it.

vuka fmt adds a missing clause, and vuka fix templates-package adds it to every template file of a module.

Wrong ​

html
<!-- layouts/admin.vuka.html -->
<script lang="go">
type Admin struct {
	Children ui.Node
}
</script>

<div class="admin">{Children}</div>
html
<!-- layouts/admin.vuka.html -->
<script lang="go">
package layouts

import "github.com/vuka-lang/ui/v2"

type Admin struct {
	Children ui.Node
}
</script>

<div class="admin">{Children}</div>

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.