Skip to content

Commit d48e67d

Browse files
committed
unix: use strconv.Itoa instead of local implementation
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]>
1 parent 2c41d75 commit d48e67d

File tree

4 files changed

+2
-55
lines changed

4 files changed

+2
-55
lines changed

unix/export_test.go

-10
This file was deleted.

unix/str.go

-27
This file was deleted.

unix/syscall_linux.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package unix
1313

1414
import (
1515
"encoding/binary"
16+
"strconv"
1617
"syscall"
1718
"time"
1819
"unsafe"
@@ -233,7 +234,7 @@ func Futimesat(dirfd int, path string, tv []Timeval) error {
233234
func Futimes(fd int, tv []Timeval) (err error) {
234235
// Believe it or not, this is the best we can do on Linux
235236
// (and is what glibc does).
236-
return Utimes("/proc/self/fd/"+itoa(fd), tv)
237+
return Utimes("/proc/self/fd/"+strconv.Itoa(fd), tv)
237238
}
238239

239240
const ImplementsGetwd = true

unix/syscall_test.go

-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package unix_test
99

1010
import (
11-
"fmt"
1211
"testing"
1312

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

37-
func TestItoa(t *testing.T) {
38-
// Make most negative integer: 0x8000...
39-
i := 1
40-
for i<<1 != 0 {
41-
i <<= 1
42-
}
43-
if i >= 0 {
44-
t.Fatal("bad math")
45-
}
46-
s := unix.Itoa(i)
47-
f := fmt.Sprint(i)
48-
if s != f {
49-
t.Fatalf("itoa(%d) = %s, want %s", i, s, f)
50-
}
51-
}
52-
5336
func TestUname(t *testing.T) {
5437
var utsname unix.Utsname
5538
err := unix.Uname(&utsname)

0 commit comments

Comments
 (0)