mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
replace ioutil with io package and other minor improvements
This commit is contained in:
@@ -50,7 +50,8 @@ type (
|
||||
// through a Context or within filter functions.
|
||||
//
|
||||
// Example:
|
||||
// AsValue("my string")
|
||||
//
|
||||
// AsValue("my string")
|
||||
//
|
||||
// Shortcut for `pongo2.AsValue`.
|
||||
var AsValue = pongo2.AsValue
|
||||
|
||||
@@ -2,7 +2,7 @@ package view
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -80,7 +80,7 @@ func asset(fs http.FileSystem, name string) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadAll(f)
|
||||
contents, err := io.ReadAll(f)
|
||||
f.Close()
|
||||
return contents, err
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ func (s *HTMLEngine) Reload(developmentMode bool) *HTMLEngine {
|
||||
//
|
||||
// missingkey: Control the behavior during execution if a map is
|
||||
// indexed with a key that is not present in the map.
|
||||
//
|
||||
// "missingkey=default" or "missingkey=invalid"
|
||||
// The default behavior: Do nothing and continue execution.
|
||||
// If printed, the result of the index operation is the string
|
||||
@@ -148,7 +149,6 @@ func (s *HTMLEngine) Reload(developmentMode bool) *HTMLEngine {
|
||||
// The operation returns the zero value for the map type's element.
|
||||
// "missingkey=error"
|
||||
// Execution stops immediately with an error.
|
||||
//
|
||||
func (s *HTMLEngine) Option(opt ...string) *HTMLEngine {
|
||||
s.rmu.Lock()
|
||||
s.options = append(s.options, opt...)
|
||||
@@ -172,7 +172,8 @@ func (s *HTMLEngine) Delims(left, right string) *HTMLEngine {
|
||||
// for the template file with its extension.
|
||||
//
|
||||
// Example: HTML("./templates", ".html").Layout("layouts/mainLayout.html")
|
||||
// // mainLayout.html is inside: "./templates/layouts/".
|
||||
//
|
||||
// // mainLayout.html is inside: "./templates/layouts/".
|
||||
//
|
||||
// Note: Layout can be changed for a specific call
|
||||
// action with the option: "layout" on the iris' context.Render function.
|
||||
|
||||
Reference in New Issue
Block a user