aboutsummaryrefslogtreecommitdiff
path: root/src/archive/tar/reader_test.go
diff options
context:
space:
mode:
authorRoger Peppe <rogpeppe@gmail.com>2021-08-11 12:50:34 +0100
committerroger peppe <rogpeppe@gmail.com>2021-08-19 09:09:02 +0000
commit740f7d73707fab5000791b71c2ab046e3e5544c7 (patch)
tree0dc846636e55968fddbc680c2a9e75ef2554b1fd /src/archive/tar/reader_test.go
parentc85695a117f1ec3b800ba14570876cfcd2075c1f (diff)
downloadgo-740f7d73707fab5000791b71c2ab046e3e5544c7.tar.xz
archive/tar: unexport internal methods
Many of the methods inside the archive/tar package don't need to be exported. Doing so sets a bad precedent that it's OK to export methods to indicate an internal public API. That's not a good idea in general, because exported methods increase cognitive load when reading code: the reader needs to consider whether the exported method might be used via some external interface or reflection. This CL should have no externally visible behaviour changes at all. Change-Id: I94a63de5e6a28e9ac8a283325217349ebce4f308 Reviewed-on: https://go-review.googlesource.com/c/go/+/341410 Reviewed-by: Joe Tsai <joetsai@digital-static.net> Trust: Joe Tsai <joetsai@digital-static.net> Trust: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/archive/tar/reader_test.go')
-rw-r--r--src/archive/tar/reader_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/archive/tar/reader_test.go b/src/archive/tar/reader_test.go
index 789ddc1bc0..c31a847ec3 100644
--- a/src/archive/tar/reader_test.go
+++ b/src/archive/tar/reader_test.go
@@ -1021,12 +1021,12 @@ func TestParsePAX(t *testing.T) {
func TestReadOldGNUSparseMap(t *testing.T) {
populateSparseMap := func(sa sparseArray, sps []string) []string {
- for i := 0; len(sps) > 0 && i < sa.MaxEntries(); i++ {
- copy(sa.Entry(i), sps[0])
+ for i := 0; len(sps) > 0 && i < sa.maxEntries(); i++ {
+ copy(sa.entry(i), sps[0])
sps = sps[1:]
}
if len(sps) > 0 {
- copy(sa.IsExtended(), "\x80")
+ copy(sa.isExtended(), "\x80")
}
return sps
}
@@ -1034,19 +1034,19 @@ func TestReadOldGNUSparseMap(t *testing.T) {
makeInput := func(format Format, size string, sps ...string) (out []byte) {
// Write the initial GNU header.
var blk block
- gnu := blk.GNU()
- sparse := gnu.Sparse()
- copy(gnu.RealSize(), size)
+ gnu := blk.toGNU()
+ sparse := gnu.sparse()
+ copy(gnu.realSize(), size)
sps = populateSparseMap(sparse, sps)
if format != FormatUnknown {
- blk.SetFormat(format)
+ blk.setFormat(format)
}
out = append(out, blk[:]...)
// Write extended sparse blocks.
for len(sps) > 0 {
var blk block
- sps = populateSparseMap(blk.Sparse(), sps)
+ sps = populateSparseMap(blk.toSparse(), sps)
out = append(out, blk[:]...)
}
return out
@@ -1359,7 +1359,7 @@ func TestFileReader(t *testing.T) {
wantCnt int64
wantErr error
}
- testRemaining struct { // LogicalRemaining() == wantLCnt, PhysicalRemaining() == wantPCnt
+ testRemaining struct { // logicalRemaining() == wantLCnt, physicalRemaining() == wantPCnt
wantLCnt int64
wantPCnt int64
}
@@ -1596,11 +1596,11 @@ func TestFileReader(t *testing.T) {
t.Errorf("test %d.%d, expected %d more operations", i, j, len(f.ops))
}
case testRemaining:
- if got := fr.LogicalRemaining(); got != tf.wantLCnt {
- t.Errorf("test %d.%d, LogicalRemaining() = %d, want %d", i, j, got, tf.wantLCnt)
+ if got := fr.logicalRemaining(); got != tf.wantLCnt {
+ t.Errorf("test %d.%d, logicalRemaining() = %d, want %d", i, j, got, tf.wantLCnt)
}
- if got := fr.PhysicalRemaining(); got != tf.wantPCnt {
- t.Errorf("test %d.%d, PhysicalRemaining() = %d, want %d", i, j, got, tf.wantPCnt)
+ if got := fr.physicalRemaining(); got != tf.wantPCnt {
+ t.Errorf("test %d.%d, physicalRemaining() = %d, want %d", i, j, got, tf.wantPCnt)
}
default:
t.Fatalf("test %d.%d, unknown test operation: %T", i, j, tf)