diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-02 13:23:25 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-03 13:12:58 +0100 |
commit | d90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch) | |
tree | 7b1b14464eefec1188ca2eed53c64e4823453cc9 /transform/livereloadinject | |
parent | 32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff) |
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'transform/livereloadinject')
-rw-r--r-- | transform/livereloadinject/livereloadinject.go | 11 | ||||
-rw-r--r-- | transform/livereloadinject/livereloadinject_test.go | 1 |
2 files changed, 5 insertions, 7 deletions
diff --git a/transform/livereloadinject/livereloadinject.go b/transform/livereloadinject/livereloadinject.go index cc80d046e..32ed55f63 100644 --- a/transform/livereloadinject/livereloadinject.go +++ b/transform/livereloadinject/livereloadinject.go @@ -30,19 +30,18 @@ type tag struct { } var tags = []tag{ - tag{markup: []byte("<head>"), appendScript: true}, - tag{markup: []byte("<HEAD>"), appendScript: true}, - tag{markup: []byte("</body>")}, - tag{markup: []byte("</BODY>")}, + {markup: []byte("<head>"), appendScript: true}, + {markup: []byte("<HEAD>"), appendScript: true}, + {markup: []byte("</body>")}, + {markup: []byte("</BODY>")}, } // New creates a function that can be used // to inject a script tag for the livereload JavaScript in a HTML document. func New(baseURL url.URL) transform.Transformer { - return func(ft transform.FromTo) error { b := ft.From().Bytes() - var idx = -1 + idx := -1 var match tag // We used to insert the livereload script right before the closing body. // This does not work when combined with tools such as Turbolinks. diff --git a/transform/livereloadinject/livereloadinject_test.go b/transform/livereloadinject/livereloadinject_test.go index 50fbb8b92..b2ec4483a 100644 --- a/transform/livereloadinject/livereloadinject_test.go +++ b/transform/livereloadinject/livereloadinject_test.go @@ -61,5 +61,4 @@ func TestLiveReloadInject(t *testing.T) { c.Run("No match", func(c *qt.C) { c.Assert(apply("<h1>No match</h1>"), qt.Equals, "<h1>No match</h1>") }) - } |