The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Showing the changes to services/gitdiff/gitdiff.go (1 of 103 files). Show all
Unified · Split
| @@ -13,7 +13,6 @@ import ( · 12 unmodified lines | ||
| 13 | 13 | "html" |
| 14 | 14 | "html/template" |
| 15 | 15 | "io" |
| 16 | − "io/ioutil" | |
| 17 | 16 | "net/url" |
| 18 | 17 | "os" |
| 19 | 18 | "os/exec" |
| @@ -721,7 +720,7 @@ parsingLoop: · 701 unmodified lines | ||
| 721 | 720 | // TODO: Handle skipping first n files |
| 722 | 721 | if len(diff.Files) >= maxFiles { |
| 723 | 722 | diff.IsIncomplete = true |
| 724 | − _, err := io.Copy(ioutil.Discard, reader) | |
| 723 | + _, err := io.Copy(io.Discard, reader) | |
| 725 | 724 | if err != nil { |
| 726 | 725 | // By the definition of io.Copy this never returns io.EOF |
| 727 | 726 | return diff, fmt.Errorf("Copy: %v", err) |
| @@ -1280,7 +1279,7 @@ func GetDiffRangeWithWhitespaceBehavior(gitRepo *git.Repository, beforeCommitID, · 552 unmodified lines | ||
| 1280 | 1279 | indexFilename, deleteTemporaryFile, err := gitRepo.ReadTreeToTemporaryIndex(afterCommitID) |
| 1281 | 1280 | if err == nil { |
| 1282 | 1281 | defer deleteTemporaryFile() |
| 1283 | − workdir, err := ioutil.TempDir("", "empty-work-dir") | |
| 1282 | + workdir, err := os.MkdirTemp("", "empty-work-dir") | |
| 1284 | 1283 | if err != nil { |
| 1285 | 1284 | log.Error("Unable to create temporary directory: %v", err) |
| 1286 | 1285 | return nil, err |