Skip to content

Commit

Permalink
unix: use strconv.Itoa instead of local implementation
Browse files Browse the repository at this point in the history
This was originally copied over from package syscall where it was
replaced by internal/itoa in CL 301549.

For golang.org/x/sys/unix we may import strconv, so use strconv.Itoa
instead.

Change-Id: Iac125fbd0f64c385f9f0c02d4a7af762364b67aa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/425304
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Run-TryBot: Tobias Klauser <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
  • Loading branch information
tklauser committed Aug 29, 2022
1 parent 2c41d75 commit d48e67d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 55 deletions.
10 changes: 0 additions & 10 deletions unix/export_test.go

This file was deleted.

27 changes: 0 additions & 27 deletions unix/str.go

This file was deleted.

3 changes: 2 additions & 1 deletion unix/syscall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package unix

import (
"encoding/binary"
"strconv"
"syscall"
"time"
"unsafe"
Expand Down Expand Up @@ -233,7 +234,7 @@ func Futimesat(dirfd int, path string, tv []Timeval) error {
func Futimes(fd int, tv []Timeval) (err error) {
// Believe it or not, this is the best we can do on Linux
// (and is what glibc does).
return Utimes("/proc/self/fd/"+itoa(fd), tv)
return Utimes("/proc/self/fd/"+strconv.Itoa(fd), tv)
}

const ImplementsGetwd = true
Expand Down
17 changes: 0 additions & 17 deletions unix/syscall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package unix_test

import (
"fmt"
"testing"

"golang.org/x/sys/unix"
Expand All @@ -34,22 +33,6 @@ func TestEnv(t *testing.T) {
testSetGetenv(t, "TESTENV", "")
}

func TestItoa(t *testing.T) {
// Make most negative integer: 0x8000...
i := 1
for i<<1 != 0 {
i <<= 1
}
if i >= 0 {
t.Fatal("bad math")
}
s := unix.Itoa(i)
f := fmt.Sprint(i)
if s != f {
t.Fatalf("itoa(%d) = %s, want %s", i, s, f)
}
}

func TestUname(t *testing.T) {
var utsname unix.Utsname
err := unix.Uname(&utsname)
Expand Down

0 comments on commit d48e67d

Please sign in to comment.