mirror of
https://github.com/foolin/goview.git
synced 2025-09-26 19:01:15 +08:00
update comments for golint
This commit is contained in:
2
doc.go
2
doc.go
@@ -1,4 +1,4 @@
|
|||||||
//package goview a lightweight, minimalist and idiomatic template library
|
//Package goview a lightweight, minimalist and idiomatic template library
|
||||||
//based on golang html/template for building Go web application.
|
//based on golang html/template for building Go web application.
|
||||||
//
|
//
|
||||||
//Example:
|
//Example:
|
||||||
|
@@ -57,7 +57,7 @@ func (v ViewRender) Render(w http.ResponseWriter) error {
|
|||||||
func (v ViewRender) WriteContentType(w http.ResponseWriter) {
|
func (v ViewRender) WriteContentType(w http.ResponseWriter) {
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
if val := header["Content-Type"]; len(val) == 0 {
|
if val := header["Content-Type"]; len(val) == 0 {
|
||||||
header["Content-Type"] = goview.HtmlContentType
|
header["Content-Type"] = goview.HTMLContentType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
view.go
6
view.go
@@ -13,8 +13,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HtmlContentType const templateEngineKey = "httpx_templateEngine"
|
// HTMLContentType const templateEngineKey = "httpx_templateEngine"
|
||||||
var HtmlContentType = []string{"text/html; charset=utf-8"}
|
var HTMLContentType = []string{"text/html; charset=utf-8"}
|
||||||
|
|
||||||
// DefaultConfig default config
|
// DefaultConfig default config
|
||||||
var DefaultConfig = Config{
|
var DefaultConfig = Config{
|
||||||
@@ -77,7 +77,7 @@ func Default() *ViewEngine {
|
|||||||
func (e *ViewEngine) Render(w http.ResponseWriter, statusCode int, name string, data interface{}) error {
|
func (e *ViewEngine) Render(w http.ResponseWriter, statusCode int, name string, data interface{}) error {
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
if val := header["Content-Type"]; len(val) == 0 {
|
if val := header["Content-Type"]; len(val) == 0 {
|
||||||
header["Content-Type"] = HtmlContentType
|
header["Content-Type"] = HTMLContentType
|
||||||
}
|
}
|
||||||
w.WriteHeader(statusCode)
|
w.WriteHeader(statusCode)
|
||||||
return e.executeRender(w, name, data)
|
return e.executeRender(w, name, data)
|
||||||
|
Reference in New Issue
Block a user