Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions embedmd/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
"strings"
)
Expand All @@ -36,7 +37,7 @@
func (fetcher) Fetch(dir, path string) ([]byte, error) {
if !strings.HasPrefix(path, "http://") && !strings.HasPrefix(path, "https://") {
path = filepath.Join(dir, filepath.FromSlash(path))
return ioutil.ReadFile(path)
return os.ReadFile(path)

Check failure on line 40 in embedmd/content.go

View workflow job for this annotation

GitHub Actions / Go Version 1.13

undefined: os.ReadFile
}

res, err := http.Get(path)
Expand All @@ -47,5 +48,5 @@
if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf("status %s", res.Status)
}
return ioutil.ReadAll(res.Body)
return io.ReadAll(res.Body)

Check failure on line 51 in embedmd/content.go

View workflow job for this annotation

GitHub Actions / Go Version 1.13

undefined: io.ReadAll
}
4 changes: 2 additions & 2 deletions integration_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"testing"
Expand All @@ -14,7 +14,7 @@ func TestIntegration(t *testing.T) {
if err != nil {
t.Fatalf("could not process file (%v): %s", err, got)
}
wants, err := ioutil.ReadFile(filepath.Join("sample", "result.md"))
wants, err := os.ReadFile(filepath.Join("sample", "result.md"))
if err != nil {
t.Fatalf("could not read result: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -132,7 +131,7 @@ func readFile(path string) ([]byte, error) {
return nil, err
}
defer f.Close()
return ioutil.ReadAll(f)
return io.ReadAll(f)
}

func processFile(path string, rewrite, doDiff bool) (foundDiff bool, err error) {
Expand Down
3 changes: 1 addition & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package main
import (
"bytes"
"io"
"io/ioutil"
"os"
"strings"
"testing"
Expand Down Expand Up @@ -146,7 +145,7 @@ func (f *fakeFile) WriteAt(b []byte, offset int64) (int, error) { return f.buf.W
func (f *fakeFile) Truncate(int64) error { return nil }

func newFakeFile(s string) *fakeFile {
return &fakeFile{ReadCloser: ioutil.NopCloser(strings.NewReader(s))}
return &fakeFile{ReadCloser: io.NopCloser(strings.NewReader(s))}
}

func newOpenFunc(files map[string]string) func(string) (file, error) {
Expand Down
Loading