mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
Using template.Must instead of catching errors manually
This commit is contained in:
parent
2ee8532a0e
commit
2398b5179d
@ -259,11 +259,7 @@ You can also use your own html template render
|
||||
import "html/template"
|
||||
func main() {
|
||||
r := gin.Default()
|
||||
html, err := template.ParseFiles("file1", "file2")
|
||||
if err != nil {
|
||||
fmt.Printf("Could not parse templates: %v\n", err)
|
||||
return
|
||||
}
|
||||
html := template.Must(template.ParseFiles("file1", "file2"))
|
||||
r.HTMLTemplates = html
|
||||
|
||||
// Listen and server on 0.0.0.0:8080
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user