aboutsummaryrefslogtreecommitdiff
path: root/lib/reflect/example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-23 03:40:50 +0700
committerShulhan <ms@kilabit.info>2025-01-23 03:41:10 +0700
commit2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch)
treecce840739c7f59893c3a6a65a1600f9f857c484e /lib/reflect/example_test.go
parent605d847b236dde031a2e387e74298d66a27b5e0a (diff)
downloadpakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/reflect/example_test.go')
-rw-r--r--lib/reflect/example_test.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/reflect/example_test.go b/lib/reflect/example_test.go
index c0b028a3..69970fea 100644
--- a/lib/reflect/example_test.go
+++ b/lib/reflect/example_test.go
@@ -458,13 +458,12 @@ func ExampleTag() {
field reflect.StructField
val string
opts []string
- x int
hasTag bool
)
vtype = reflect.TypeOf(t)
- for x = 0; x < vtype.NumField(); x++ {
+ for x := range vtype.NumField() {
field = vtype.Field(x)
val, opts, hasTag = libreflect.Tag(field, "atag")
fmt.Println(val, opts, hasTag)