Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 2 additions & 14 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 9 additions & 9 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 + "("))
Expand All @@ -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)))
Expand All @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion fs_embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
2 changes: 1 addition & 1 deletion render.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (r *Render) compileTemplatesFromDir() {
return
}
}
watcher.Close()
_ = watcher.Close()
r.CompileTemplates()
}()
}
Expand Down