]> Cypherpunks repositories - gostls13.git/commitdiff
move ReadFile, WriteFile, and ReadDir into a separate io/ioutil package.
authorRob Pike <r@golang.org>
Thu, 3 Dec 2009 06:02:14 +0000 (22:02 -0800)
committerRob Pike <r@golang.org>
Thu, 3 Dec 2009 06:02:14 +0000 (22:02 -0800)
this breaks the dependency of package io on package bytes.

R=rsc
CC=golang-dev
https://golang.org/cl/163085

30 files changed:
src/cmd/cgo/util.go
src/cmd/ebnflint/ebnflint.go
src/cmd/godoc/godoc.go
src/cmd/gofmt/gofmt.go
src/cmd/hgpatch/main.go
src/pkg/Makefile
src/pkg/archive/tar/writer_test.go
src/pkg/compress/flate/deflate_test.go
src/pkg/compress/zlib/writer_test.go
src/pkg/debug/proc/proc_linux.go
src/pkg/ebnf/ebnf_test.go
src/pkg/encoding/ascii85/ascii85_test.go
src/pkg/encoding/base64/base64_test.go
src/pkg/encoding/git85/git_test.go
src/pkg/exec/exec_test.go
src/pkg/exp/eval/main.go
src/pkg/go/parser/interface.go
src/pkg/go/printer/printer_test.go
src/pkg/http/client_test.go
src/pkg/http/request.go
src/pkg/io/Makefile
src/pkg/io/io.go
src/pkg/io/ioutil/Makefile [new file with mode: 0644]
src/pkg/io/ioutil/ioutil.go [moved from src/pkg/io/utils.go with 94% similarity]
src/pkg/io/ioutil/ioutil_test.go [moved from src/pkg/io/utils_test.go with 94% similarity]
src/pkg/os/os_test.go
src/pkg/path/path.go
src/pkg/time/zoneinfo.go
test/bench/k-nucleotide.go
test/bench/regex-dna.go

index 53b3ef6a30e1edbaad488fad746809201ace3da8..176e9528e846dddbbef60e5c68f1cafbc2017e12 100644 (file)
@@ -8,7 +8,7 @@ import (
        "exec";
        "fmt";
        "go/token";
-       "io";
+       "io/ioutil";
        "os";
 )
 
@@ -57,11 +57,11 @@ func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) {
        }();
        var xstdout []byte;     // TODO(rsc): delete after 6g can take address of out parameter
        go func() {
-               xstdout, _ = io.ReadAll(r1);
+               xstdout, _ = ioutil.ReadAll(r1);
                r1.Close();
                c <- true;
        }();
-       stderr, _ = io.ReadAll(r2);
+       stderr, _ = ioutil.ReadAll(r2);
        r2.Close();
        <-c;
        <-c;
index bd0ea34b5cd08b2e7777f9e526d6c4e2f9497c2e..4904780a330aa7c70ab1d50b8ad16f18bc2c3288 100644 (file)
@@ -10,7 +10,7 @@ import (
        "flag";
        "fmt";
        "go/scanner";
-       "io";
+       "io/ioutil";
        "os";
        "path";
        "strings";
@@ -84,7 +84,7 @@ func main() {
                usage()
        }
 
-       src, err := io.ReadFile(filename);
+       src, err := ioutil.ReadFile(filename);
        if err != nil {
                scanner.PrintError(os.Stderr, err)
        }
index 5f86100cbb2ddab04c8178c178745619e66f6d3d..ec89d69a8af308490c4273d50e81d6908062bfcc 100644 (file)
@@ -15,6 +15,7 @@ import (
        "go/token";
        "http";
        "io";
+       "io/ioutil";
        "log";
        "os";
        pathutil "path";
@@ -192,7 +193,7 @@ func newDirTree(path, name string, depth, maxDepth int) *Directory {
                return &Directory{depth, path, name, "", nil}
        }
 
-       list, _ := io.ReadDir(path);    // ignore errors
+       list, _ := ioutil.ReadDir(path);        // ignore errors
 
        // determine number of subdirectories and package files
        ndirs := 0;
@@ -633,7 +634,7 @@ var fmap = template.FormatterMap{
 
 func readTemplate(name string) *template.Template {
        path := pathutil.Join(*tmplroot, name);
-       data, err := io.ReadFile(path);
+       data, err := ioutil.ReadFile(path);
        if err != nil {
                log.Exitf("ReadFile %s: %v", path, err)
        }
@@ -718,7 +719,7 @@ func commentText(src []byte) (text string) {
 
 func serveHTMLDoc(c *http.Conn, r *http.Request, path string) {
        // get HTML body contents
-       src, err := io.ReadFile(path);
+       src, err := ioutil.ReadFile(path);
        if err != nil {
                log.Stderrf("%v", err);
                http.NotFound(c, r);
@@ -815,7 +816,7 @@ func isTextFile(path string) bool {
 
 
 func serveTextFile(c *http.Conn, r *http.Request, path string) {
-       src, err := io.ReadFile(path);
+       src, err := ioutil.ReadFile(path);
        if err != nil {
                log.Stderrf("serveTextFile: %s", err)
        }
@@ -834,7 +835,7 @@ func serveDirectory(c *http.Conn, r *http.Request, path string) {
                return
        }
 
-       list, err := io.ReadDir(path);
+       list, err := ioutil.ReadDir(path);
        if err != nil {
                http.NotFound(c, r);
                return;
index cea8d4d34eb2839b3033c2bb96204081de5b622b..b3a96857d579fd3f0de6f25f2c5a1836f5813218 100644 (file)
@@ -12,7 +12,7 @@ import (
        "go/parser";
        "go/printer";
        "go/scanner";
-       "io";
+       "io/ioutil";
        "os";
        pathutil "path";
        "strings";
@@ -86,7 +86,7 @@ func isGoFile(d *os.Dir) bool {
 
 
 func processFile(f *os.File) os.Error {
-       src, err := io.ReadAll(f);
+       src, err := ioutil.ReadAll(f);
        if err != nil {
                return err
        }
@@ -112,7 +112,7 @@ func processFile(f *os.File) os.Error {
                        fmt.Fprintln(os.Stdout, f.Name())
                }
                if *write {
-                       err = io.WriteFile(f.Name(), res.Bytes(), 0);
+                       err = ioutil.WriteFile(f.Name(), res.Bytes(), 0);
                        if err != nil {
                                return err
                        }
index 96b5ef496194ae3f5d0630eab6dd2d3b39f930de..3d2b0817e2f1b02fe05fc08f75057c1f19f47609 100644 (file)
@@ -11,6 +11,7 @@ import (
        "flag";
        "fmt";
        "io";
+       "io/ioutil";
        "os";
        "patch";
        "path";
@@ -35,9 +36,9 @@ func main() {
        var err os.Error;
        switch len(args) {
        case 0:
-               data, err = io.ReadAll(os.Stdin)
+               data, err = ioutil.ReadAll(os.Stdin)
        case 1:
-               data, err = io.ReadFile(args[0])
+               data, err = ioutil.ReadFile(args[0])
        default:
                usage()
        }
@@ -87,7 +88,7 @@ func main() {
        }
 
        // Apply changes in memory.
-       op, err := pset.Apply(io.ReadFile);
+       op, err := pset.Apply(ioutil.ReadFile);
        chk(err);
 
        // Write changes to disk copy: order of commands matters.
@@ -143,7 +144,7 @@ func main() {
                        changed[o.Dst] = 1;
                }
                if o.Data != nil {
-                       chk(io.WriteFile(o.Dst, o.Data, 0644));
+                       chk(ioutil.WriteFile(o.Dst, o.Data, 0644));
                        if o.Verb == patch.Add {
                                undoRm(o.Dst)
                        } else {
index 62173d53a687cfadde8c5658e61f714cb8af0f17..dd2a8584e8dd85a0d21b84dc84e45ff1e9a90053 100644 (file)
@@ -70,6 +70,7 @@ DIRS=\
        image\
        image/png\
        io\
+       io/ioutil\
        json\
        log\
        malloc\
index 4a6c486f8d07f763ff6becf9489baed61009f71a..0df0144b1ceb926dc1ccaab56f80b7f0738b02ee 100644 (file)
@@ -8,6 +8,7 @@ import (
        "bytes";
        "fmt";
        "io";
+       "io/ioutil";
        "testing";
        "testing/iotest";
 )
@@ -121,7 +122,7 @@ func bytediff(a []byte, b []byte) string {
 func TestWriter(t *testing.T) {
 testLoop:
        for i, test := range writerTests {
-               expected, err := io.ReadFile(test.file);
+               expected, err := ioutil.ReadFile(test.file);
                if err != nil {
                        t.Errorf("test %d: Unexpected error: %v", i, err);
                        continue;
index 01e97f34dc088195f5dab9c119b4e7ba13409248..9d5ada994521c2d4c3987a65faf29cb806e17471 100644 (file)
@@ -7,7 +7,7 @@ package flate
 import (
        "bytes";
        "fmt";
-       "io";
+       "io/ioutil";
        "os";
        "testing";
 )
@@ -96,7 +96,7 @@ func testToFromWithLevel(t *testing.T, level int, input []byte, name string) os.
        w.Write(input);
        w.Close();
        inflater := NewInflater(buffer);
-       decompressed, err := io.ReadAll(inflater);
+       decompressed, err := ioutil.ReadAll(inflater);
        if err != nil {
                t.Errorf("reading inflater: %s", err);
                return err;
index 13c20d9d1c37dc142b535b636148577b7eace664..963a072e9d0ae877c5d9498ecdadb35b734e26b5 100644 (file)
@@ -6,6 +6,7 @@ package zlib
 
 import (
        "io";
+       "io/ioutil";
        "os";
        "testing";
 )
@@ -72,8 +73,8 @@ func testFileLevel(t *testing.T, fn string, level int) {
        defer zlibr.Close();
 
        // Compare the two.
-       b0, err0 := io.ReadAll(golden);
-       b1, err1 := io.ReadAll(zlibr);
+       b0, err0 := ioutil.ReadAll(golden);
+       b1, err1 := ioutil.ReadAll(zlibr);
        if err0 != nil {
                t.Errorf("%s (level=%d): %v", fn, level, err0);
                return;
index c17e6855b882e29ac041f9b02420bcd97ce0dcd1..b7192580d77a1224840008a4d6143fbc2b2c1050 100644 (file)
@@ -9,7 +9,7 @@ package proc
 import (
        "container/vector";
        "fmt";
-       "io";
+       "io/ioutil";
        "os";
        "runtime";
        "strconv";
@@ -1215,7 +1215,7 @@ func (p *process) attachAllThreads() os.Error {
                        if err != nil {
                                // There could have been a race, or
                                // this process could be a zobmie.
-                               statFile, err2 := io.ReadFile(taskPath + "/" + tidStr + "/stat");
+                               statFile, err2 := ioutil.ReadFile(taskPath + "/" + tidStr + "/stat");
                                if err2 != nil {
                                        switch err2 := err2.(type) {
                                        case *os.PathError:
index 3eda8d9a3c92154e3d306a83e3ad84a515dff518..a487bdc2cf51760510c43d5f1939b677bd8ff46d 100644 (file)
@@ -5,7 +5,7 @@
 package ebnf
 
 import (
-       "io";
+       "io/ioutil";
        "strings";
        "testing";
 )
@@ -65,7 +65,7 @@ var files = []string{
 
 func TestFiles(t *testing.T) {
        for _, filename := range files {
-               src, err := io.ReadFile(filename);
+               src, err := ioutil.ReadFile(filename);
                if err != nil {
                        t.Fatal(err)
                }
index 40bb1a25e80e6e76cfd072f8a727a254594510fb..294f6382555d82117b4bdafc8a65fc1f83d20bf1 100644 (file)
@@ -6,7 +6,7 @@ package ascii85
 
 import (
        "bytes";
-       "io";
+       "io/ioutil";
        "os";
        "reflect";
        "strings";
@@ -111,7 +111,7 @@ func TestDecode(t *testing.T) {
 func TestDecoder(t *testing.T) {
        for _, p := range pairs {
                decoder := NewDecoder(bytes.NewBufferString(p.encoded));
-               dbuf, err := io.ReadAll(decoder);
+               dbuf, err := ioutil.ReadAll(decoder);
                if err != nil {
                        t.Fatal("Read failed", err)
                }
@@ -176,7 +176,7 @@ func TestBig(t *testing.T) {
        if err != nil {
                t.Fatalf("Encoder.Close() = %v want nil", err)
        }
-       decoded, err := io.ReadAll(NewDecoder(encoded));
+       decoded, err := ioutil.ReadAll(NewDecoder(encoded));
        if err != nil {
                t.Fatalf("io.ReadAll(NewDecoder(...)): %v", err)
        }
index 51e40ed7e5b557a1420e1682c3629abef7cd0654..3153a73470bbfb49b2ec2810fdd57a2ee7b8662e 100644 (file)
@@ -6,7 +6,7 @@ package base64
 
 import (
        "bytes";
-       "io";
+       "io/ioutil";
        "os";
        "reflect";
        "strings";
@@ -184,9 +184,9 @@ func TestBig(t *testing.T) {
        if err != nil {
                t.Fatalf("Encoder.Close() = %v want nil", err)
        }
-       decoded, err := io.ReadAll(NewDecoder(StdEncoding, encoded));
+       decoded, err := ioutil.ReadAll(NewDecoder(StdEncoding, encoded));
        if err != nil {
-               t.Fatalf("io.ReadAll(NewDecoder(...)): %v", err)
+               t.Fatalf("ioutil.ReadAll(NewDecoder(...)): %v", err)
        }
 
        if !bytes.Equal(raw, decoded) {
index 713524af2859fb7317fa31426c578ac94c79a2a1..07367ddec67567b5503851190bba50643a8ccbd5 100644 (file)
@@ -6,7 +6,7 @@ package git85
 
 import (
        "bytes";
-       "io";
+       "io/ioutil";
        "os";
        "reflect";
        "strings";
@@ -117,7 +117,7 @@ func TestDecode(t *testing.T) {
 func TestDecoder(t *testing.T) {
        for _, p := range gitPairs {
                decoder := NewDecoder(bytes.NewBufferString(p.encoded));
-               dbuf, err := io.ReadAll(decoder);
+               dbuf, err := ioutil.ReadAll(decoder);
                if err != nil {
                        t.Fatal("Read failed", err)
                }
@@ -182,9 +182,9 @@ func TestGitBig(t *testing.T) {
        if err != nil {
                t.Fatalf("Encoder.Close() = %v want nil", err)
        }
-       decoded, err := io.ReadAll(NewDecoder(encoded));
+       decoded, err := ioutil.ReadAll(NewDecoder(encoded));
        if err != nil {
-               t.Fatalf("io.ReadAll(NewDecoder(...)): %v", err)
+               t.Fatalf("ioutil.ReadAll(NewDecoder(...)): %v", err)
        }
 
        if !bytes.Equal(raw, decoded) {
index af86b55a028d40e9540ad079879c70a4df6d22e0..5a997fd1990326f33498a532d90a51167693e9f5 100644 (file)
@@ -6,6 +6,7 @@ package exec
 
 import (
        "io";
+       "io/ioutil";
        "testing";
 )
 
@@ -17,7 +18,7 @@ func TestRunCat(t *testing.T) {
        }
        io.WriteString(cmd.Stdin, "hello, world\n");
        cmd.Stdin.Close();
-       buf, err := io.ReadAll(cmd.Stdout);
+       buf, err := ioutil.ReadAll(cmd.Stdout);
        if err != nil {
                t.Fatalf("reading from /bin/cat: %v", err)
        }
@@ -35,7 +36,7 @@ func TestRunEcho(t *testing.T) {
        if err != nil {
                t.Fatalf("opencmd /bin/echo: %v", err)
        }
-       buf, err := io.ReadAll(cmd.Stdout);
+       buf, err := ioutil.ReadAll(cmd.Stdout);
        if err != nil {
                t.Fatalf("reading from /bin/echo: %v", err)
        }
index 769fc07763996af6ab91131be9c7e954cac66dd9..376af6b86d112927147dc45d1cd5a9a6c28f8ca2 100644 (file)
@@ -20,7 +20,7 @@ func main() {
        flag.Parse();
        w := eval.NewWorld();
        if *filename != "" {
-               data, err := io.ReadFile(*filename);
+               data, err := ioutil.ReadFile(*filename);
                if err != nil {
                        println(err.String());
                        os.Exit(1);
index 6704894629ee0055d984d5a87bddc0de04afd8fe..7e8f5d25ef6a8fd8090e12e0e7f07133eb45de53 100644 (file)
@@ -12,6 +12,7 @@ import (
        "go/ast";
        "go/scanner";
        "io";
+       "io/ioutil";
        "os";
        pathutil "path";
        "strings";
@@ -46,7 +47,7 @@ func readSource(filename string, src interface{}) ([]byte, os.Error) {
                }
        }
 
-       return io.ReadFile(filename);
+       return ioutil.ReadFile(filename);
 }
 
 
@@ -138,7 +139,7 @@ func ParseFile(filename string, src interface{}, mode uint) (*ast.File, os.Error
 // flags that control the amount of source text parsed are ignored.
 //
 func ParsePkgFile(pkgname, filename string, mode uint) (*ast.File, os.Error) {
-       src, err := io.ReadFile(filename);
+       src, err := ioutil.ReadFile(filename);
        if err != nil {
                return nil, err
        }
index 5c10d4a85d3252854fe4b26b5f18b138838d0836..c85ddb00f8bfddc47d0225ab0ed4ef2e714c0cd5 100644 (file)
@@ -7,7 +7,7 @@ package printer
 import (
        "bytes";
        "flag";
-       "io";
+       "io/ioutil";
        "go/ast";
        "go/parser";
        "path";
@@ -70,14 +70,14 @@ func check(t *testing.T, source, golden string, mode checkMode) {
 
        // update golden files if necessary
        if *update {
-               if err := io.WriteFile(golden, res, 0644); err != nil {
+               if err := ioutil.WriteFile(golden, res, 0644); err != nil {
                        t.Error(err)
                }
                return;
        }
 
        // get golden
-       gld, err := io.ReadFile(golden);
+       gld, err := ioutil.ReadFile(golden);
        if err != nil {
                t.Error(err);
                return;
index 8f52130677f060ccabeed95cbc87a96c2a2a2b80..76aad7e81524660e700d8f489a1e28f3fff59720 100644 (file)
@@ -7,7 +7,7 @@
 package http
 
 import (
-       "io";
+       "io/ioutil";
        "strings";
        "testing";
 )
@@ -19,7 +19,7 @@ func TestClient(t *testing.T) {
        r, _, err := Get("http://www.google.com/robots.txt");
        var b []byte;
        if err == nil {
-               b, err = io.ReadAll(r.Body);
+               b, err = ioutil.ReadAll(r.Body);
                r.Body.Close();
        }
        if err != nil {
index ce49f7cf85a4ad84bf11a872854b83b61e34c728..83374a54945d8549ee4346cbbd0f654ead6ec093 100644 (file)
@@ -15,6 +15,7 @@ import (
        "container/vector";
        "fmt";
        "io";
+       "io/ioutil";
        "os";
        "strconv";
        "strings";
@@ -626,7 +627,7 @@ func (r *Request) ParseForm() (err os.Error) {
                switch strings.Split(ct, ";", 2)[0] {
                case "text/plain", "application/x-www-form-urlencoded", "":
                        var b []byte;
-                       if b, err = io.ReadAll(r.Body); err != nil {
+                       if b, err = ioutil.ReadAll(r.Body); err != nil {
                                return err
                        }
                        query = string(b);
index cbe691644ed3f757da1505698b4f8a1da6225a84..8c27ce551db32eb9d35af660fa301fd145d72845 100644 (file)
@@ -8,6 +8,5 @@ TARG=io
 GOFILES=\
        io.go\
        pipe.go\
-       utils.go\
 
 include ../../Make.pkg
index b389af45a4d626a36b9bc47f9150bd0b1b3ef1b9..c4850da9128cf1b60a0c802ece78bf32a15626ee 100644 (file)
@@ -5,8 +5,7 @@
 // This package provides basic interfaces to I/O primitives.
 // Its primary job is to wrap existing implementations of such primitives,
 // such as those in package os, into shared public interfaces that
-// abstract the functionality.
-// It also provides buffering primitives and some other basic operations.
+// abstract the functionality, plus some other related primitives.
 package io
 
 import (
diff --git a/src/pkg/io/ioutil/Makefile b/src/pkg/io/ioutil/Makefile
new file mode 100644 (file)
index 0000000..3abf714
--- /dev/null
@@ -0,0 +1,11 @@
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include ../../../Make.$(GOARCH)
+
+TARG=io/ioutil
+GOFILES=\
+       ioutil.go\
+
+include ../../../Make.pkg
similarity index 94%
rename from src/pkg/io/utils.go
rename to src/pkg/io/ioutil/ioutil.go
index 0e0b84ae49e982285410584a25940d39712b9652..a38e488111e0a7fa85661385132b3d3e193ea564 100644 (file)
@@ -4,18 +4,19 @@
 
 // Utility functions.
 
-package io
+package ioutil
 
 import (
        "bytes";
+       "io";
        "os";
        "sort";
 )
 
 // ReadAll reads from r until an error or EOF and returns the data it read.
-func ReadAll(r Reader) ([]byte, os.Error) {
+func ReadAll(r io.Reader) ([]byte, os.Error) {
        var buf bytes.Buffer;
-       _, err := Copy(&buf, r);
+       _, err := io.Copy(&buf, r);
        return buf.Bytes(), err;
 }
 
@@ -41,7 +42,7 @@ func ReadFile(filename string) ([]byte, os.Error) {
        // we'll either waste some space off the end or reallocate as needed, but
        // in the overwhelmingly common case we'll get it just right.
        buf := bytes.NewBuffer(make([]byte, n)[0:0]);
-       _, err = Copy(buf, f);
+       _, err = io.Copy(buf, f);
        return buf.Bytes(), err;
 }
 
@@ -56,7 +57,7 @@ func WriteFile(filename string, data []byte, perm int) os.Error {
        n, err := f.Write(data);
        f.Close();
        if err == nil && n < len(data) {
-               err = ErrShortWrite
+               err = io.ErrShortWrite
        }
        return err;
 }
similarity index 94%
rename from src/pkg/io/utils_test.go
rename to src/pkg/io/ioutil/ioutil_test.go
index b7f6e80f4127a4ab01c522e6df4016d64755ed09..d0720f2233697a0158cfdb11da9bae4fbcc96a6d 100644 (file)
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package io_test
+package ioutil_test
 
 import (
-       . "io";
+       . "io/ioutil";
        "os";
        "strings";
        "testing";
@@ -28,7 +28,7 @@ func TestReadFile(t *testing.T) {
                t.Fatalf("ReadFile %s: error expected, none found", filename)
        }
 
-       filename = "utils_test.go";
+       filename = "ioutil_test.go";
        contents, err = ReadFile(filename);
        if err != nil {
                t.Fatalf("ReadFile %s: %v", filename, err)
@@ -78,7 +78,7 @@ func TestReadDir(t *testing.T) {
        foundObj := false;
        for _, dir := range list {
                switch {
-               case dir.IsRegular() && dir.Name == "utils_test.go":
+               case dir.IsRegular() && dir.Name == "ioutil_test.go":
                        foundTest = true
                case dir.IsDirectory() && dir.Name == "_obj":
                        foundObj = true
index 8c390198108cd74a1558d3d0034e2f2d061bbd9f..ed3d955cb30e702e9254f71a4b509c2a435f0c82 100644 (file)
@@ -8,6 +8,7 @@ import (
        "bytes";
        "fmt";
        "io";
+       "io/ioutil";
        . "os";
        "strings";
        "testing";
@@ -666,7 +667,7 @@ func TestWriteAt(t *testing.T) {
                t.Fatalf("WriteAt 7: %d, %v", n, err)
        }
 
-       b, err := io.ReadFile("_obj/writetest");
+       b, err := ioutil.ReadFile("_obj/writetest");
        if err != nil {
                t.Fatalf("ReadFile _obj/writetest: %v", err)
        }
index e5b9e989d26307306d38216538c32b4442602b48..59deb5ce9128ab3d7140d642324dada04f32be3d 100644 (file)
@@ -7,7 +7,7 @@
 package path
 
 import (
-       "io";
+       "io/ioutil";
        "os";
        "strings";
 )
@@ -155,7 +155,7 @@ func walk(path string, d *os.Dir, v Visitor, errors chan<- os.Error) {
                return  // skip directory entries
        }
 
-       list, err := io.ReadDir(path);
+       list, err := ioutil.ReadDir(path);
        if err != nil {
                if errors != nil {
                        errors <- err
index 40f8f0feb65310916846613b23bf870b467893e0..8d8048aa055da153df45bd7a9c5a25e891bde9b2 100644 (file)
@@ -10,7 +10,7 @@
 package time
 
 import (
-       "io";
+       "io/ioutil";
        "once";
        "os";
 )
@@ -195,7 +195,7 @@ func parseinfo(bytes []byte) (zt []zonetime, ok bool) {
 }
 
 func readinfofile(name string) ([]zonetime, bool) {
-       buf, err := io.ReadFile(name);
+       buf, err := ioutil.ReadFile(name);
        if err != nil {
                return nil, false
        }
index d256b372f5607fb4d8b61fc56e456baa499caca9..47debecb3d0d7a577087ff87cb45b66c4816c89a 100644 (file)
@@ -39,7 +39,7 @@ import (
        "bufio";
        "bytes";
        "fmt";
-       "io";
+       "io/ioutil";
        "os";
        "sort";
        "strings";
@@ -122,7 +122,7 @@ func main() {
                        break
                }
        }
-       data, err := io.ReadAll(in);
+       data, err := ioutil.ReadAll(in);
        if err != nil {
                fmt.Fprintln(os.Stderr, "ReadAll err:", err);
                os.Exit(2);
index 75133dc85ea17906214699b4897664e13109daf8..2e1ab8edb2ee761f596edb2ff0f85d46335e2c6c 100644 (file)
@@ -37,7 +37,7 @@ package main
 
 import (
        "fmt";
-       "io";
+       "io/ioutil";
        "os";
        "regexp";
        "strings";
@@ -88,7 +88,7 @@ func countMatches(pat string, bytes []byte) int {
 }
 
 func main() {
-       bytes, err := io.ReadFile("/dev/stdin");
+       bytes, err := ioutil.ReadFile("/dev/stdin");
        if err != nil {
                fmt.Fprintf(os.Stderr, "can't read input: %s\n", err);
                os.Exit(2);