aboutsummaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-25 23:00:56 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-10-26 14:24:17 +0000
commit283d8a3d53ac1c7e1d7e297497480bf0071b6300 (patch)
treece7ce589f19e3880f341703797da01ffede0ee05 /src/html
parenta2b8c186f616db92f9812e09fb2c44b0e753f8a7 (diff)
downloadgo-283d8a3d53ac1c7e1d7e297497480bf0071b6300.tar.gz
go-283d8a3d53ac1c7e1d7e297497480bf0071b6300.zip
all: use reflect.{Pointer,PointerTo}
Updates #47651 Updates #48665 Change-Id: I69a87b45a5cad7a07fbd855040cd9935cf874554 Reviewed-on: https://go-review.googlesource.com/c/go/+/358454 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/html')
-rw-r--r--src/html/template/content.go6
-rw-r--r--src/html/template/js.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/html/template/content.go b/src/html/template/content.go
index 6ba87a9550..232ba199f3 100644
--- a/src/html/template/content.go
+++ b/src/html/template/content.go
@@ -116,12 +116,12 @@ func indirect(a interface{}) interface{} {
if a == nil {
return nil
}
- if t := reflect.TypeOf(a); t.Kind() != reflect.Ptr {
+ if t := reflect.TypeOf(a); t.Kind() != reflect.Pointer {
// Avoid creating a reflect.Value if it's not a pointer.
return a
}
v := reflect.ValueOf(a)
- for v.Kind() == reflect.Ptr && !v.IsNil() {
+ for v.Kind() == reflect.Pointer && !v.IsNil() {
v = v.Elem()
}
return v.Interface()
@@ -140,7 +140,7 @@ func indirectToStringerOrError(a interface{}) interface{} {
return nil
}
v := reflect.ValueOf(a)
- for !v.Type().Implements(fmtStringerType) && !v.Type().Implements(errorType) && v.Kind() == reflect.Ptr && !v.IsNil() {
+ for !v.Type().Implements(fmtStringerType) && !v.Type().Implements(errorType) && v.Kind() == reflect.Pointer && !v.IsNil() {
v = v.Elem()
}
return v.Interface()
diff --git a/src/html/template/js.go b/src/html/template/js.go
index 32a4fbd30a..7e919c48e6 100644
--- a/src/html/template/js.go
+++ b/src/html/template/js.go
@@ -132,7 +132,7 @@ func indirectToJSONMarshaler(a interface{}) interface{} {
}
v := reflect.ValueOf(a)
- for !v.Type().Implements(jsonMarshalType) && v.Kind() == reflect.Ptr && !v.IsNil() {
+ for !v.Type().Implements(jsonMarshalType) && v.Kind() == reflect.Pointer && !v.IsNil() {
v = v.Elem()
}
return v.Interface()