Skip to content

Commit 6784357

Browse files
committed
update dep rules
Change-Id: Ibde843d506c5d2b0945172a41a041bab2709c978
1 parent 3f98e3d commit 6784357

File tree

32 files changed

+134
-158
lines changed

32 files changed

+134
-158
lines changed

src/archive/zip/reader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package zip
66

77
import (
88
"bytes"
9+
"encoding/binary"
910
"encoding/hex"
10-
"internal/binarylite"
1111
"internal/obscuretestdata"
1212
"io"
1313
"io/fs"
@@ -788,7 +788,7 @@ func TestInvalidFiles(t *testing.T) {
788788

789789
// repeated directoryEndSignatures
790790
sig := make([]byte, 4)
791-
binarylite.LittleEndian.PutUint32(sig, directoryEndSignature)
791+
binary.LittleEndian.PutUint32(sig, directoryEndSignature)
792792
for i := 0; i < size-4; i += 4 {
793793
copy(b[i:i+4], sig)
794794
}

src/archive/zip/writer_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ package zip
77
import (
88
"bytes"
99
"compress/flate"
10+
"encoding/binary"
1011
"fmt"
1112
"hash/crc32"
12-
"internal/binarylite"
1313
"io"
1414
"io/fs"
1515
"math/rand"
@@ -346,7 +346,7 @@ func TestWriterDirAttributes(t *testing.T) {
346346
b := buf.Bytes()
347347

348348
var sig [4]byte
349-
binarylite.LittleEndian.PutUint32(sig[:], uint32(fileHeaderSignature))
349+
binary.LittleEndian.PutUint32(sig[:], uint32(fileHeaderSignature))
350350

351351
idx := bytes.Index(b, sig[:])
352352
if idx == -1 {
@@ -362,7 +362,7 @@ func TestWriterDirAttributes(t *testing.T) {
362362
t.Errorf("unexpected crc, compress and uncompressed size to be 0 was: %v", b[14:26])
363363
}
364364

365-
binarylite.LittleEndian.PutUint32(sig[:], uint32(dataDescriptorSignature))
365+
binary.LittleEndian.PutUint32(sig[:], uint32(dataDescriptorSignature))
366366
if bytes.Contains(b, sig[:]) {
367367
t.Error("there should be no data descriptor")
368368
}

src/cmd/cgo/internal/testcshared/cshared_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"cmd/cgo/internal/cgotest"
1111
"debug/elf"
1212
"debug/pe"
13+
"encoding/binary"
1314
"flag"
1415
"fmt"
15-
"internal/binarylite"
1616
"internal/testenv"
1717
"log"
1818
"os"
@@ -432,7 +432,7 @@ func main() {
432432
_ [3]uint32
433433
}
434434
var e IMAGE_EXPORT_DIRECTORY
435-
if err := binarylite.Read(section.Open(), binarylite.LittleEndian, &e); err != nil {
435+
if err := binary.Read(section.Open(), binary.LittleEndian, &e); err != nil {
436436
t.Fatalf("binary.Read failed: %v", err)
437437
}
438438

src/cmd/cgo/internal/testshared/shared_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"bytes"
1010
"cmd/cgo/internal/cgotest"
1111
"debug/elf"
12+
"encoding/binary"
1213
"flag"
1314
"fmt"
1415
"go/build"
15-
"internal/binarylite"
1616
"internal/platform"
1717
"internal/testenv"
1818
"io"
@@ -417,18 +417,18 @@ func readNotes(f *elf.File) ([]*note, error) {
417417
r := sect.Open()
418418
for {
419419
var namesize, descsize, tag int32
420-
err := binarylite.Read(r, f.ByteOrder, &namesize)
420+
err := binary.Read(r, f.ByteOrder, &namesize)
421421
if err != nil {
422422
if err == io.EOF {
423423
break
424424
}
425425
return nil, fmt.Errorf("read namesize failed: %v", err)
426426
}
427-
err = binarylite.Read(r, f.ByteOrder, &descsize)
427+
err = binary.Read(r, f.ByteOrder, &descsize)
428428
if err != nil {
429429
return nil, fmt.Errorf("read descsize failed: %v", err)
430430
}
431-
err = binarylite.Read(r, f.ByteOrder, &tag)
431+
err = binary.Read(r, f.ByteOrder, &tag)
432432
if err != nil {
433433
return nil, fmt.Errorf("read type failed: %v", err)
434434
}

src/cmd/compile/internal/test/memcombine_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
package test
66

77
import (
8-
"internal/binarylite"
8+
"encoding/binary"
99
"testing"
1010
)
1111

1212
var gv = [16]byte{0, 1, 2, 3, 4, 5, 6, 7, 8}
1313

1414
//go:noinline
1515
func readGlobalUnaligned() uint64 {
16-
return binarylite.LittleEndian.Uint64(gv[1:])
16+
return binary.LittleEndian.Uint64(gv[1:])
1717
}
1818

1919
func TestUnalignedGlobal(t *testing.T) {
@@ -45,25 +45,25 @@ func TestSpillOfExtendedEndianLoads(t *testing.T) {
4545
}
4646

4747
func readUint16le(b []byte) uint64 {
48-
y := uint64(binarylite.LittleEndian.Uint16(b))
48+
y := uint64(binary.LittleEndian.Uint16(b))
4949
nop() // force spill
5050
return y
5151
}
5252

5353
func readUint16be(b []byte) uint64 {
54-
y := uint64(binarylite.BigEndian.Uint16(b))
54+
y := uint64(binary.BigEndian.Uint16(b))
5555
nop() // force spill
5656
return y
5757
}
5858

5959
func readUint32le(b []byte) uint64 {
60-
y := uint64(binarylite.LittleEndian.Uint32(b))
60+
y := uint64(binary.LittleEndian.Uint32(b))
6161
nop() // force spill
6262
return y
6363
}
6464

6565
func readUint32be(b []byte) uint64 {
66-
y := uint64(binarylite.BigEndian.Uint32(b))
66+
y := uint64(binary.BigEndian.Uint32(b))
6767
nop() // force spill
6868
return y
6969
}

src/cmd/go/go_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"debug/elf"
1010
"debug/macho"
1111
"debug/pe"
12+
"encoding/binary"
1213
"flag"
1314
"fmt"
1415
"go/format"
15-
"internal/binarylite"
1616
"internal/godebug"
1717
"internal/platform"
1818
"internal/testenv"
@@ -2145,7 +2145,7 @@ func testBuildmodePIE(t *testing.T, useCgo, setBuildmodeToPIE bool) {
21452145
_ [3]uint32
21462146
}
21472147
var e IMAGE_EXPORT_DIRECTORY
2148-
if err := binarylite.Read(section.Open(), binarylite.LittleEndian, &e); err != nil {
2148+
if err := binary.Read(section.Open(), binary.LittleEndian, &e); err != nil {
21492149
t.Fatalf("binary.Read failed: %v", err)
21502150
}
21512151

src/cmd/go/internal/cache/cache_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package cache
66

77
import (
88
"bytes"
9+
"encoding/binary"
910
"fmt"
10-
"internal/binarylite"
1111
"internal/testenv"
1212
"os"
1313
"path/filepath"
@@ -146,7 +146,7 @@ func TestVerifyPanic(t *testing.T) {
146146

147147
func dummyID(x int) [HashSize]byte {
148148
var out [HashSize]byte
149-
binarylite.LittleEndian.PutUint64(out[:], uint64(x))
149+
binary.LittleEndian.PutUint64(out[:], uint64(x))
150150
return out
151151
}
152152

src/cmd/go/internal/lockedfile/transform_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package lockedfile_test
1010

1111
import (
1212
"bytes"
13-
"internal/binarylite"
13+
"encoding/binary"
1414
"math/rand"
1515
"path/filepath"
1616
"testing"
@@ -43,7 +43,7 @@ func TestTransform(t *testing.T) {
4343
const maxChunkWords = 8 << 10
4444
buf := make([]byte, 2*maxChunkWords*8)
4545
for i := uint64(0); i < 2*maxChunkWords; i++ {
46-
binarylite.LittleEndian.PutUint64(buf[i*8:], i)
46+
binary.LittleEndian.PutUint64(buf[i*8:], i)
4747
}
4848
if err := lockedfile.Write(path, bytes.NewReader(buf[:8]), 0666); err != nil {
4949
t.Fatal(err)
@@ -80,9 +80,9 @@ func TestTransform(t *testing.T) {
8080
return chunk, nil
8181
}
8282

83-
u := binarylite.LittleEndian.Uint64(data)
83+
u := binary.LittleEndian.Uint64(data)
8484
for i := 1; i < words; i++ {
85-
next := binarylite.LittleEndian.Uint64(data[i*8:])
85+
next := binary.LittleEndian.Uint64(data[i*8:])
8686
if next != u+1 {
8787
t.Errorf("wrote sequential integers, but read integer out of sequence at offset %d", i)
8888
return chunk, nil

src/cmd/internal/buildid/buildid_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"bytes"
99
"crypto/sha256"
1010
"debug/elf"
11-
"internal/binarylite"
11+
"encoding/binary"
1212
"internal/obscuretestdata"
1313
"os"
1414
"reflect"
@@ -105,10 +105,10 @@ func TestReadFile(t *testing.T) {
105105
if elf.Data(data[elf.EI_DATA]) != elf.ELFDATA2LSB {
106106
continue
107107
}
108-
order := binarylite.LittleEndian
108+
order := binary.LittleEndian
109109

110110
var hdr elf.Header64
111-
if err := binarylite.Read(bytes.NewReader(data), order, &hdr); err != nil {
111+
if err := binary.Read(bytes.NewReader(data), order, &hdr); err != nil {
112112
t.Error(err)
113113
continue
114114
}
@@ -119,7 +119,7 @@ func TestReadFile(t *testing.T) {
119119

120120
for i := 0; i < phnum; i++ {
121121
var phdr elf.Prog64
122-
if err := binarylite.Read(bytes.NewReader(data[phoff:]), order, &phdr); err != nil {
122+
if err := binary.Read(bytes.NewReader(data[phoff:]), order, &phdr); err != nil {
123123
t.Error(err)
124124
continue
125125
}

src/cmd/internal/objfile/disasm.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"bytes"
1010
"container/list"
1111
"debug/gosym"
12+
"encoding/binary"
1213
"fmt"
13-
"internal/binarylite"
1414
"io"
1515
"os"
1616
"path/filepath"
@@ -29,14 +29,14 @@ import (
2929

3030
// Disasm is a disassembler for a given File.
3131
type Disasm struct {
32-
syms []Sym //symbols in file, sorted by address
33-
pcln Liner // pcln table
34-
text []byte // bytes of text segment (actual instructions)
35-
textStart uint64 // start PC of text
36-
textEnd uint64 // end PC of text
37-
goarch string // GOARCH string
38-
disasm disasmFunc // disassembler function for goarch
39-
byteOrder binarylite.ByteOrder // byte order for goarch
32+
syms []Sym //symbols in file, sorted by address
33+
pcln Liner // pcln table
34+
text []byte // bytes of text segment (actual instructions)
35+
textStart uint64 // start PC of text
36+
textEnd uint64 // end PC of text
37+
goarch string // GOARCH string
38+
disasm disasmFunc // disassembler function for goarch
39+
byteOrder binary.ByteOrder // byte order for goarch
4040
}
4141

4242
// Disasm returns a disassembler for the file f.
@@ -291,13 +291,13 @@ func (d *Disasm) Decode(start, end uint64, relocs []Reloc, gnuAsm bool, f func(p
291291
}
292292

293293
type lookupFunc = func(addr uint64) (sym string, base uint64)
294-
type disasmFunc func(code []byte, pc uint64, lookup lookupFunc, ord binarylite.ByteOrder, _ bool) (text string, size int)
294+
type disasmFunc func(code []byte, pc uint64, lookup lookupFunc, ord binary.ByteOrder, _ bool) (text string, size int)
295295

296-
func disasm_386(code []byte, pc uint64, lookup lookupFunc, _ binarylite.ByteOrder, gnuAsm bool) (string, int) {
296+
func disasm_386(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int) {
297297
return disasm_x86(code, pc, lookup, 32, gnuAsm)
298298
}
299299

300-
func disasm_amd64(code []byte, pc uint64, lookup lookupFunc, _ binarylite.ByteOrder, gnuAsm bool) (string, int) {
300+
func disasm_amd64(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int) {
301301
return disasm_x86(code, pc, lookup, 64, gnuAsm)
302302
}
303303

@@ -338,7 +338,7 @@ func (r textReader) ReadAt(data []byte, off int64) (n int, err error) {
338338
return
339339
}
340340

341-
func disasm_arm(code []byte, pc uint64, lookup lookupFunc, _ binarylite.ByteOrder, gnuAsm bool) (string, int) {
341+
func disasm_arm(code []byte, pc uint64, lookup lookupFunc, _ binary.ByteOrder, gnuAsm bool) (string, int) {
342342
inst, err := armasm.Decode(code, armasm.ModeARM)
343343
var text string
344344
size := inst.Len
@@ -353,7 +353,7 @@ func disasm_arm(code []byte, pc uint64, lookup lookupFunc, _ binarylite.ByteOrde
353353
return text, size
354354
}
355355

356-
func disasm_arm64(code []byte, pc uint64, lookup lookupFunc, byteOrder binarylite.ByteOrder, gnuAsm bool) (string, int) {
356+
func disasm_arm64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int) {
357357
inst, err := arm64asm.Decode(code)
358358
var text string
359359
if err != nil || inst.Op == 0 {
@@ -366,7 +366,7 @@ func disasm_arm64(code []byte, pc uint64, lookup lookupFunc, byteOrder binarylit
366366
return text, 4
367367
}
368368

369-
func disasm_ppc64(code []byte, pc uint64, lookup lookupFunc, byteOrder binarylite.ByteOrder, gnuAsm bool) (string, int) {
369+
func disasm_ppc64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.ByteOrder, gnuAsm bool) (string, int) {
370370
inst, err := ppc64asm.Decode(code, byteOrder)
371371
var text string
372372
size := inst.Len
@@ -392,14 +392,14 @@ var disasms = map[string]disasmFunc{
392392
"ppc64le": disasm_ppc64,
393393
}
394394

395-
var byteOrders = map[string]binarylite.ByteOrder{
396-
"386": binarylite.LittleEndian,
397-
"amd64": binarylite.LittleEndian,
398-
"arm": binarylite.LittleEndian,
399-
"arm64": binarylite.LittleEndian,
400-
"ppc64": binarylite.BigEndian,
401-
"ppc64le": binarylite.LittleEndian,
402-
"s390x": binarylite.BigEndian,
395+
var byteOrders = map[string]binary.ByteOrder{
396+
"386": binary.LittleEndian,
397+
"amd64": binary.LittleEndian,
398+
"arm": binary.LittleEndian,
399+
"arm64": binary.LittleEndian,
400+
"ppc64": binary.BigEndian,
401+
"ppc64le": binary.LittleEndian,
402+
"s390x": binary.BigEndian,
403403
}
404404

405405
type Liner interface {

src/cmd/internal/objfile/elf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ package objfile
99
import (
1010
"debug/dwarf"
1111
"debug/elf"
12+
"encoding/binary"
1213
"fmt"
13-
"internal/binarylite"
1414
"io"
1515
)
1616

@@ -121,7 +121,7 @@ func (f *elfFile) goarch() string {
121121
case elf.EM_AARCH64:
122122
return "arm64"
123123
case elf.EM_PPC64:
124-
if f.elf.ByteOrder == binarylite.LittleEndian {
124+
if f.elf.ByteOrder == binary.LittleEndian {
125125
return "ppc64le"
126126
}
127127
return "ppc64"

0 commit comments

Comments
 (0)