diff options
| author | Shulhan <ms@kilabit.info> | 2025-01-23 03:40:50 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-23 03:41:10 +0700 |
| commit | 2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch) | |
| tree | cce840739c7f59893c3a6a65a1600f9f857c484e /lib/net/net.go | |
| parent | 605d847b236dde031a2e387e74298d66a27b5e0a (diff) | |
| download | pakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz | |
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/net/net.go')
| -rw-r--r-- | lib/net/net.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/net/net.go b/lib/net/net.go index 4add0435..e52831d1 100644 --- a/lib/net/net.go +++ b/lib/net/net.go @@ -1,6 +1,6 @@ -// Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info> +// +// SPDX-License-Identifier: BSD-3-Clause // Package net provide constants and library for networking. package net @@ -176,14 +176,14 @@ func ToDotIPv6(ip net.IP) (out []byte) { addrs := strings.Split(ip.String(), ":") var notempty int - for x := 0; x < len(addrs); x++ { + for x := range len(addrs) { if len(addrs[x]) != 0 { notempty++ } } gap := 8 - notempty - for x := 0; x < len(addrs); x++ { + for x := range len(addrs) { addr := addrs[x] // Fill the gap "::" with one or more "0.0.0.0". @@ -205,7 +205,7 @@ func ToDotIPv6(ip net.IP) (out []byte) { out = append(out, '0') } - for y := 0; y < len(addr); y++ { + for y := range len(addr) { if len(out) > 0 { out = append(out, '.') } |
