unix: run go fix

Generated by running:

    go fix ./...

Change-Id: I4dab4582f1bdee9fc44710b8d10ca2dd9989f49d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/821060
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/unix/getdirentries_test.go b/unix/getdirentries_test.go
index c8a184b..27417dd 100644
--- a/unix/getdirentries_test.go
+++ b/unix/getdirentries_test.go
@@ -30,7 +30,7 @@
 	d := t.TempDir()
 
 	var names []string
-	for i := 0; i < count; i++ {
+	for i := range count {
 		names = append(names, fmt.Sprintf("file%03d", i))
 	}
 
diff --git a/unix/internal/mkmerge/mkmerge_test.go b/unix/internal/mkmerge/mkmerge_test.go
index 29b584d..035f9c7 100644
--- a/unix/internal/mkmerge/mkmerge_test.go
+++ b/unix/internal/mkmerge/mkmerge_test.go
@@ -290,7 +290,7 @@
 
 	// Generate source code for different "architectures"
 	var inFiles, outFiles []srcFile
-	for _, arch := range strings.Fields("A B C D") {
+	for arch := range strings.FieldsSeq("A B C D") {
 		buf := new(bytes.Buffer)
 		err := inTmpl.Execute(buf, arch)
 		if err != nil {
diff --git a/unix/syscall.go b/unix/syscall.go
index 5ea74da..8f27e7e 100644
--- a/unix/syscall.go
+++ b/unix/syscall.go
@@ -76,7 +76,7 @@
 	// Find NUL terminator.
 	n := 0
 	for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
-		ptr = unsafe.Pointer(uintptr(ptr) + 1)
+		ptr = unsafe.Add(ptr, 1)
 	}
 
 	return string(unsafe.Slice(p, n))
diff --git a/unix/syscall_bsd.go b/unix/syscall_bsd.go
index a00c3e5..035c2cd 100644
--- a/unix/syscall_bsd.go
+++ b/unix/syscall_bsd.go
@@ -188,7 +188,7 @@
 	}
 	sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL
 	sa.raw.Family = AF_UNIX
-	for i := 0; i < n; i++ {
+	for i := range n {
 		sa.raw.Path[i] = int8(name[i])
 	}
 	return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index 21e2bfa..6926057 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -2363,7 +2363,7 @@
 	if n == 0 {
 		return nil
 	}
-	return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type))+4)), n)
+	return unsafe.Slice((*byte)(unsafe.Add(unsafe.Pointer(&fh.fileHandle.Type), 4)), n)
 }
 
 // NameToHandleAt wraps the name_to_handle_at system call; it obtains
diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go
index 30720b5..7bf78e6 100644
--- a/unix/syscall_linux_test.go
+++ b/unix/syscall_linux_test.go
@@ -1188,7 +1188,7 @@
 	// Test deduplication with two blocks of zeros
 	data := make([]byte, 4096)
 
-	for i := 0; i < 2; i += 1 {
+	for range 2 {
 		_, err = f1.Write(data)
 		if err != nil {
 			t.Fatal(err)
@@ -1201,7 +1201,7 @@
 	}
 	defer f2.Close()
 
-	for i := 0; i < 2; i += 1 {
+	for i := range 2 {
 		// Make the 2nd block different
 		if i == 1 {
 			data[1] = 1
diff --git a/unix/syscall_unix_test.go b/unix/syscall_unix_test.go
index 3bb5c7a..4f0d84c 100644
--- a/unix/syscall_unix_test.go
+++ b/unix/syscall_unix_test.go
@@ -967,9 +967,7 @@
 	defer unix.Close(fds[1])
 
 	var wg sync.WaitGroup
-	wg.Add(1)
-	go func() {
-		defer wg.Done()
+	wg.Go(func() {
 		bufs := [][]byte{
 			make([]byte, 5),
 			nil,
@@ -997,7 +995,7 @@
 		if !reflect.DeepEqual(bufs, want) {
 			t.Errorf("got data %q, want %q", bufs, want)
 		}
-	}()
+	})
 
 	defer wg.Wait()