Skip to content

Commit

Permalink
fix: replace depracted io/ioutil package with os package
Browse files Browse the repository at this point in the history
  • Loading branch information
gulien committed Aug 19, 2022
1 parent 159c0b3 commit d8f3f85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/modules/api/formdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package api

import (
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"sort"
"strconv"
Expand Down Expand Up @@ -426,7 +426,7 @@ func (form *FormData) mandatoryPath(filename string, target *string) *FormData {
// readFile binds the content of a file to a string variable. It populates an
// error if it fails to read the file content.
func (form *FormData) readFile(path, filename string, target *string) *FormData {
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
form.append(
fmt.Errorf("form file '%s' is invalid (%w)", filename, err),
Expand Down
3 changes: 1 addition & 2 deletions pkg/modules/chromium/chromium.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
Expand Down Expand Up @@ -808,7 +807,7 @@ func (mod Chromium) PDF(ctx context.Context, logger *zap.Logger, URL, outputPath
return fmt.Errorf("%v: %w", consoleExceptions, ErrConsoleExceptions)
}

err = ioutil.WriteFile(outputPath, buffer, 0600)
err = os.WriteFile(outputPath, buffer, 0600)
if err != nil {
return fmt.Errorf("write result to output path: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/modules/chromium/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -271,7 +270,7 @@ func convertMarkdownRoute(chromium API, engine gotenberg.PDFEngine) api.Route {
return "", nil
}

b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return "", fmt.Errorf("read markdown file '%s': %w", filename, err)
}
Expand Down

0 comments on commit d8f3f85

Please sign in to comment.