aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pack
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-07-07 13:49:21 -0400
committerRuss Cox <rsc@golang.org>2020-10-20 02:32:42 +0000
commit7bb721b9384bdd196befeaed593b185f7f2a5589 (patch)
tree882f21fc2e1fbba6fb11100e4fd8efc5f973a44d /src/cmd/pack
parentd4da735091986868015369e01c63794af9cc9b84 (diff)
downloadgo-7bb721b9384bdd196befeaed593b185f7f2a5589.tar.gz
go-7bb721b9384bdd196befeaed593b185f7f2a5589.zip
all: update references to symbols moved from os to io/fs
The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/cmd/pack')
-rw-r--r--src/cmd/pack/pack.go3
-rw-r--r--src/cmd/pack/pack_test.go11
2 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/pack/pack.go b/src/cmd/pack/pack.go
index c4e116becd..82546ea7dc 100644
--- a/src/cmd/pack/pack.go
+++ b/src/cmd/pack/pack.go
@@ -8,6 +8,7 @@ import (
"cmd/internal/archive"
"fmt"
"io"
+ "io/fs"
"log"
"os"
"path/filepath"
@@ -221,7 +222,7 @@ func (ar *Archive) addFiles() {
// FileLike abstracts the few methods we need, so we can test without needing real files.
type FileLike interface {
Name() string
- Stat() (os.FileInfo, error)
+ Stat() (fs.FileInfo, error)
Read([]byte) (int, error)
Close() error
}
diff --git a/src/cmd/pack/pack_test.go b/src/cmd/pack/pack_test.go
index 2108330742..9f65705def 100644
--- a/src/cmd/pack/pack_test.go
+++ b/src/cmd/pack/pack_test.go
@@ -11,6 +11,7 @@ import (
"fmt"
"internal/testenv"
"io"
+ "io/fs"
"io/ioutil"
"os"
"os/exec"
@@ -327,11 +328,11 @@ var goodbyeFile = &FakeFile{
mode: 0644,
}
-// FakeFile implements FileLike and also os.FileInfo.
+// FakeFile implements FileLike and also fs.FileInfo.
type FakeFile struct {
name string
contents string
- mode os.FileMode
+ mode fs.FileMode
offset int
}
@@ -348,7 +349,7 @@ func (f *FakeFile) Name() string {
return f.name
}
-func (f *FakeFile) Stat() (os.FileInfo, error) {
+func (f *FakeFile) Stat() (fs.FileInfo, error) {
return f, nil
}
@@ -365,13 +366,13 @@ func (f *FakeFile) Close() error {
return nil
}
-// os.FileInfo methods.
+// fs.FileInfo methods.
func (f *FakeFile) Size() int64 {
return int64(len(f.contents))
}
-func (f *FakeFile) Mode() os.FileMode {
+func (f *FakeFile) Mode() fs.FileMode {
return f.mode
}