Skip to content

Commit 630c67e

Browse files
committed
update code for go version 1.24
1 parent e5e5d6f commit 630c67e

File tree

90 files changed

+337
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+337
-167
lines changed

_benchmarks/view/ace/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -21,7 +25,7 @@ func index(ctx iris.Context) {
2125

2226
ctx.ViewLayout("layouts/main")
2327
if err := ctx.View("index", data); err != nil {
24-
ctx.HTML("<h3>%s</h3>", err.Error())
28+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2529
return
2630
}
2731
}

_benchmarks/view/blocks/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -23,7 +27,7 @@ func index(ctx iris.Context) {
2327

2428
ctx.ViewLayout("main")
2529
if err := ctx.View("index", data); err != nil {
26-
ctx.HTML("<h3>%s</h3>", err.Error())
30+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2731
return
2832
}
2933
}

_benchmarks/view/django/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -22,7 +26,7 @@ func index(ctx iris.Context) {
2226
// Layouts are only rendered from inside the index page itself
2327
// using the "extends" keyword.
2428
if err := ctx.View("index", data); err != nil {
25-
ctx.HTML("<h3>%s</h3>", err.Error())
29+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2630
return
2731
}
2832
}

_benchmarks/view/handlebars/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -20,7 +24,7 @@ func index(ctx iris.Context) {
2024

2125
ctx.ViewLayout("layouts/main")
2226
if err := ctx.View("index", data); err != nil {
23-
ctx.HTML("<h3>%s</h3>", err.Error())
27+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2428
return
2529
}
2630
}

_benchmarks/view/html/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -21,7 +25,7 @@ func index(ctx iris.Context) {
2125

2226
ctx.ViewLayout("layouts/main")
2327
if err := ctx.View("index", data); err != nil {
24-
ctx.HTML("<h3>%s</h3>", err.Error())
28+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2529
return
2630
}
2731
}

_benchmarks/view/jet/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -22,7 +26,7 @@ func index(ctx iris.Context) {
2226
// Layouts are only rendered from inside the index page itself
2327
// using the "extends" keyword.
2428
if err := ctx.View("index", data); err != nil {
25-
ctx.HTML("<h3>%s</h3>", err.Error())
29+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2630
return
2731
}
2832
}

_benchmarks/view/pug/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "github.com/kataras/iris/v12"
3+
import (
4+
"fmt"
5+
6+
"github.com/kataras/iris/v12"
7+
)
48

59
func main() {
610
app := iris.New()
@@ -23,7 +27,7 @@ func index(ctx iris.Context) {
2327
// Layouts are only rendered from inside the index page itself
2428
// using the "extends" keyword.
2529
if err := ctx.View("index", data); err != nil {
26-
ctx.HTML("<h3>%s</h3>", err.Error())
30+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
2731
return
2832
}
2933
}

_examples/auth/auth/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func main() {
119119

120120
func renderSigninForm(ctx iris.Context) {
121121
if err := ctx.View("signin", iris.Map{"Title": "Signin Page"}); err != nil {
122-
ctx.HTML("<h3>%s</h3>", err.Error())
122+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
123123
return
124124
}
125125
}

_examples/auth/goth/main.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package main
2121
// are fixed in the time I wrote that example, have fun!
2222
import (
2323
"errors"
24+
"fmt"
2425
"os"
2526
"sort"
2627

@@ -380,7 +381,7 @@ func main() {
380381
if err := ctx.View("user.html", iris.Map{
381382
"user": user,
382383
}); err != nil {
383-
ctx.HTML("<h3>%s</h3>", err.Error())
384+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
384385
return
385386
}
386387
})
@@ -399,14 +400,14 @@ func main() {
399400
}
400401

401402
if err := ctx.View("user.html", gothUser); err != nil {
402-
ctx.HTML("<h3>%s</h3>", err.Error())
403+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
403404
return
404405
}
405406
})
406407

407408
app.Get("/", func(ctx iris.Context) {
408409
if err := ctx.View("index.html", providerIndex); err != nil {
409-
ctx.HTML("<h3>%s</h3>", err.Error())
410+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
410411
return
411412
}
412413
})

_examples/auth/hcaptcha/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/kataras/iris/v12"
@@ -43,7 +44,7 @@ func register(ctx iris.Context) {
4344
func registerForm(ctx iris.Context) {
4445
ctx.ViewData("SiteKey", siteKey)
4546
if err := ctx.View("register_form.html"); err != nil {
46-
ctx.HTML("<h3>%s</h3>", err.Error())
47+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
4748
return
4849
}
4950
}

_examples/bootstrapper/bootstrap/bootstrapper.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package bootstrap
22

33
import (
4+
"fmt"
45
"time"
56

67
"github.com/gorilla/securecookie"
@@ -78,7 +79,7 @@ func (b *Bootstrapper) SetupErrorHandlers() {
7879
ctx.ViewData("Err", err)
7980
ctx.ViewData("Title", "Error")
8081
if err := ctx.View("shared/error.html"); err != nil {
81-
ctx.HTML("<h3>%s</h3>", err.Error())
82+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
8283
return
8384
}
8485
})
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package routes
22

33
import (
4+
"fmt"
5+
46
"github.com/kataras/iris/v12"
57
)
68

79
// GetIndexHandler handles the GET: /
810
func GetIndexHandler(ctx iris.Context) {
911
ctx.ViewData("Title", "Index Page")
1012
if err := ctx.View("index.html"); err != nil {
11-
ctx.HTML("<h3>%s</h3>", err.Error())
13+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
1214
return
1315
}
1416
}

_examples/dropzonejs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func main() {
107107
// GET: http://localhost:8080
108108
app.Get("/", func(ctx iris.Context) {
109109
if err := ctx.View("upload.html"); err != nil {
110-
ctx.HTML("<h3>%s</h3>", err.Error())
110+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
111111
return
112112
}
113113
})

_examples/dropzonejs/README_PART2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func main() {
172172

173173
app.Get("/", func(ctx iris.Context) {
174174
if err := ctx.View("upload.html"); err != nil {
175-
ctx.HTML("<h3>%s</h3>", err.Error())
175+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
176176
return
177177
}
178178
})

_examples/dropzonejs/src/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"image/jpeg"
56
"image/png"
67
"io"
@@ -125,7 +126,7 @@ func main() {
125126

126127
app.Get("/", func(ctx iris.Context) {
127128
if err := ctx.View("upload.html"); err != nil {
128-
ctx.HTML("<h3>%s</h3>", err.Error())
129+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
129130
return
130131
}
131132
})

_examples/file-server/file-server/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func uploadView(ctx iris.Context) {
9595
token := fmt.Sprintf("%x", h.Sum(nil))
9696

9797
if err := ctx.View("upload.html", token); err != nil {
98-
ctx.HTML("<h3>%s</h3>", err.Error())
98+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
9999
return
100100
}
101101
}

_examples/file-server/single-page-application/embedded-single-page-application/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"fmt"
5+
46
"github.com/kataras/iris/v12"
57
)
68

@@ -27,7 +29,7 @@ func newApp() *iris.Application {
2729
app.Get("/", func(ctx iris.Context) {
2830
ctx.ViewData("Page", page)
2931
if err := ctx.View("index.html"); err != nil {
30-
ctx.HTML("<h3>%s</h3>", err.Error())
32+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
3133
return
3234
}
3335
})

_examples/file-server/spa-vue-router/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func fullVueRouter() {
2828
2929
func index(ctx iris.Context) {
3030
if err := ctx.View("index.html"); err != nil {
31-
ctx.HTML("<h3>%s</h3>", err.Error())
31+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
3232
return
3333
}
3434
}

_examples/file-server/upload-file/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func main() {
3232
// or add second argument to the `View` method.
3333
// Token will be passed as {{.}} in the template.
3434
if err := ctx.View("upload_form.html", token); err != nil {
35-
ctx.HTML("<h3>%s</h3>", err.Error())
35+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
3636
return
3737
}
3838
})

_examples/file-server/upload-files/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func newApp() *iris.Application {
3333

3434
// render the form with the token for any use you'd like.
3535
if err := ctx.View("upload_form.html", token); err != nil {
36-
ctx.HTML("<h3>%s</h3>", err.Error())
36+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
3737
return
3838
}
3939
})

_examples/i18n/basic/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func newApp() *iris.Application {
8787
return template.HTML(ctx.Tr(message, args...))
8888
},
8989
}); err != nil {
90-
ctx.HTML("<h3>%s</h3>", err.Error())
90+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
9191
return
9292
}
9393

_examples/logging/request-logger/accesslog-broker/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/kataras/iris/v12"
@@ -62,7 +63,7 @@ func notFoundHandler(ctx iris.Context) {
6263

6364
ctx.HTML("Did you mean?<ul>")
6465
for _, s := range suggestPaths {
65-
ctx.HTML(`<li><a href="%s">%s</a></li>`, s, s)
66+
ctx.HTML(fmt.Sprintf(`<li><a href="%s">%s</a></li>`, s, s))
6667
}
6768
ctx.HTML("</ul>")
6869
}
@@ -73,7 +74,7 @@ func indexHandler(ctx iris.Context) {
7374

7475
func profileHandler(ctx iris.Context) {
7576
username := ctx.Params().Get("username")
76-
ctx.HTML("Hello, <strong>%s</strong>!", username)
77+
ctx.HTML(fmt.Sprintf("Hello, <strong>%s</strong>!", username))
7778
}
7879

7980
func readBodyHandler(ctx iris.Context) {

_examples/mvc/login/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package main
44

55
import (
6+
"fmt"
67
"time"
78

89
"github.com/kataras/iris/v12/_examples/mvc/login/datasource"
@@ -34,7 +35,7 @@ func main() {
3435
ctx.ViewData("Message", ctx.Values().
3536
GetStringDefault("message", "The page you're looking for doesn't exist"))
3637
if err := ctx.View("shared/error.html"); err != nil {
37-
ctx.HTML("<h3>%s</h3>", err.Error())
38+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
3839
return
3940
}
4041
})

_examples/mvc/websocket-auth/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func newApp() *iris.Application {
5252

5353
func renderSigninForm(ctx iris.Context) {
5454
if err := ctx.View("signin", iris.Map{"Title": "Signin Page"}); err != nil {
55-
ctx.HTML("<h3>%s</h3>", err.Error())
55+
ctx.HTML(fmt.Sprintf("<h3>%s</h3>", err.Error()))
5656
return
5757
}
5858
}

0 commit comments

Comments
 (0)