Skip to content

W0107: A .vuka.html file in the Go-header form ​

Since 2.3 a .vuka.html file holds its Go — package clause, imports, the struct, its hooks and methods — in a <script lang="go">, the file's first element, and its markup below it. Files written before 2.3 have the Go bare above the markup, which starts at the first line beginning with <. That form still compiles in 2.x and is removed in 3.0.

vukavet reports it, with a suggested fix that rewrites the file, and in the editor the code action Write the Go in <script lang="go"> does the same. vuka fix shape-script rewrites every file of a module, and vuka fmt -rewrite the files it formats; the Go and the markup are kept as written.

Wrong ​

html
<!-- counter.vuka.html -->
package components

type Counter struct{ n int }

func (c *Counter) Add() { c.n++ }
<button onClick={Add}>{n}</button>
html
<!-- counter.vuka.html -->
<script lang="go">
package components

type Counter struct{ n int }

func (c *Counter) Add() { c.n++ }
</script>

<button onClick={Add}>{n}</button>

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.