From 3852c823fdcbedc006bc5f7f0319d2de59ff1675 Mon Sep 17 00:00:00 2001 From: Cory Jacobsen Date: Fri, 1 May 2026 20:38:57 +0000 Subject: [PATCH] chore: updating repo --- .github/workflows/lint.yaml | 4 ++-- .github/workflows/test.yaml | 6 +++--- .golangci.yaml | 16 ++-------------- engine.go | 18 +++++++++--------- fs_embed.go | 4 +++- go.mod | 6 +++--- go.sum | 9 ++++----- render.go | 2 +- 8 files changed, 27 insertions(+), 38 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 117e017..0457244 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -11,9 +11,9 @@ jobs: golangci: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: path: src/github.com/unrolled/render - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v9 with: working-directory: src/github.com/unrolled/render diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d3b9d04..c98a2ba 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,12 +11,12 @@ jobs: tests: strategy: matrix: - go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x] + go-version: [1.25.x, 1.26.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - run: make ci diff --git a/.golangci.yaml b/.golangci.yaml index 42a44b7..5ec3bbc 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,30 +1,18 @@ +version: "2" + run: - timeout: 10m modules-download-mode: readonly allow-parallel-runners: true -issues: - exclude: - - G203 - exclude-rules: - - path: _test\.go - linters: - - lll - - err113 - linters: - enable-all: true disable: - copyloopvar - cyclop - depguard - - execinquery - exhaustruct - - exportloopref - funlen - gocognit - goconst - - gomnd - intrange - paralleltest - testpackage diff --git a/engine.go b/engine.go index 69701da..e3103bb 100644 --- a/engine.go +++ b/engine.go @@ -81,10 +81,10 @@ func (d Data) Render(w io.Writer, v interface{}) error { if hw, ok := w.(http.ResponseWriter); ok { c := hw.Header().Get(ContentType) if c != "" { - d.Head.ContentType = c + d.ContentType = c } - d.Head.Write(hw) + d.Write(hw) } _, _ = w.Write(v.([]byte)) @@ -107,7 +107,7 @@ func (h HTML) Render(w io.Writer, binding interface{}) error { } if hw, ok := w.(http.ResponseWriter); ok { - h.Head.Write(hw) + h.Write(hw) } _, _ = buf.WriteTo(w) @@ -137,7 +137,7 @@ func (j JSON) Render(w io.Writer, v interface{}) error { // JSON marshaled fine, write out the result. if hw, ok := w.(http.ResponseWriter); ok { - j.Head.Write(hw) + j.Write(hw) } if len(j.Prefix) > 0 { @@ -156,7 +156,7 @@ func (j JSON) Render(w io.Writer, v interface{}) error { func (j JSON) renderStreamingJSON(w io.Writer, v interface{}) error { if hw, ok := w.(http.ResponseWriter); ok { - j.Head.Write(hw) + j.Write(hw) } if len(j.Prefix) > 0 { @@ -191,7 +191,7 @@ func (j JSONP) Render(w io.Writer, v interface{}) error { // JSON marshaled fine, write out the result. if hw, ok := w.(http.ResponseWriter); ok { - j.Head.Write(hw) + j.Write(hw) } _, _ = w.Write([]byte(j.Callback + "(")) @@ -211,10 +211,10 @@ func (t Text) Render(w io.Writer, v interface{}) error { if hw, ok := w.(http.ResponseWriter); ok { c := hw.Header().Get(ContentType) if c != "" { - t.Head.ContentType = c + t.ContentType = c } - t.Head.Write(hw) + t.Write(hw) } _, _ = w.Write([]byte(v.(string))) @@ -241,7 +241,7 @@ func (x XML) Render(w io.Writer, v interface{}) error { // XML marshaled fine, write out the result. if hw, ok := w.(http.ResponseWriter); ok { - x.Head.Write(hw) + x.Write(hw) } if len(x.Prefix) > 0 { diff --git a/fs_embed.go b/fs_embed.go index 01e6446..f0bca7c 100644 --- a/fs_embed.go +++ b/fs_embed.go @@ -53,7 +53,9 @@ func (tfs tmplFS) ReadFile(filename string) ([]byte, error) { if err != nil { return nil, err } - defer f.Close() + defer func() { + _ = f.Close() + }() return io.ReadAll(f) } diff --git a/go.mod b/go.mod index 058b31e..f2b1335 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/unrolled/render -go 1.17 +go 1.25.0 -require github.com/fsnotify/fsnotify v1.6.0 +require github.com/fsnotify/fsnotify v1.10.0 -require golang.org/x/sys v0.13.0 // indirect +require golang.org/x/sys v0.43.0 // indirect diff --git a/go.sum b/go.sum index 9a93033..932ecea 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,4 @@ -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/fsnotify/fsnotify v1.10.0 h1:Xx/5Ydg9CeBDX/wi4VJqStNtohYjitZhhlHt4h3St1M= +github.com/fsnotify/fsnotify v1.10.0/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= diff --git a/render.go b/render.go index 9827aca..3bf5d36 100644 --- a/render.go +++ b/render.go @@ -332,7 +332,7 @@ func (r *Render) compileTemplatesFromDir() { return } } - watcher.Close() + _ = watcher.Close() r.CompileTemplates() }() }