all: simplify code by using modern Go constructs

Generated using modernize by running:

    go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...

Change-Id: Ifc7d61cf6735cc53f2bdf890a338961f55075af5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/661975
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Tobias Klauser
2025-04-03 13:04:48 -07:00
committed by Gopher Robot
parent 1b2bd6bb49
commit 01aaa8342f
8 changed files with 33 additions and 54 deletions
+3 -3
View File
@@ -367,7 +367,7 @@ func TestTime(t *testing.T) {
var now time.Time
for i := 0; i < 10; i++ {
for range 10 {
ut, err = unix.Time(nil)
if err != nil {
t.Fatalf("Time: %v", err)
@@ -555,7 +555,7 @@ func TestSchedSetaffinity(t *testing.T) {
cpu = 1
if !oldMask.IsSet(cpu) {
newMask.Zero()
for i := 0; i < len(oldMask); i++ {
for i := range len(oldMask) {
if oldMask.IsSet(i) {
newMask.Set(i)
break
@@ -878,7 +878,7 @@ func openMountByID(mountID int) (f *os.File, err error) {
}
defer mi.Close()
bs := bufio.NewScanner(mi)
wantPrefix := []byte(fmt.Sprintf("%v ", mountID))
wantPrefix := fmt.Appendf(nil, "%v ", mountID)
for bs.Scan() {
if !bytes.HasPrefix(bs.Bytes(), wantPrefix) {
continue