Skip to content

Commit

Permalink
fix: deprecated io/ioutil to os or io functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DblK committed Aug 19, 2022
1 parent a772319 commit ba86732
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
uses: golangci/[email protected]
with:
version: v1.47.1
version: v1.48.0
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ linters:
- whitespace
# - wsl
- exportloopref
- golint
- gochecknoglobals
disable:
- noctx
Expand Down
4 changes: 2 additions & 2 deletions go/api_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ package openapi
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"

"github.com/gorilla/mux"
Expand Down Expand Up @@ -218,7 +218,7 @@ func (c *EditAPIController) PostRender(w http.ResponseWriter, r *http.Request) {
if c.debug {
queryFile, err := json.MarshalIndent(editParam, "", " ")
if err == nil {
_ = ioutil.WriteFile("query.json", queryFile, 0600)
_ = os.WriteFile("query.json", queryFile, 0600)
}
}

Expand Down
4 changes: 2 additions & 2 deletions go/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package openapi
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -486,7 +486,7 @@ func (s *FFMPEG) CloseTrack(trackNumber int) error {
}

func (s *FFMPEG) generateOutputName() string {
file, err := ioutil.TempFile("", "*."+s.format)
file, err := os.CreateTemp("", "*."+s.format)
if err != nil {
fmt.Println("Error temp file", err)
return ""
Expand Down
3 changes: 1 addition & 2 deletions go/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -291,7 +290,7 @@ func (s *ProcessingQueue) FetchAssets(queue *RenderQueue) {
}

func (s *ProcessingQueue) DownloadFile(url string) (string, error) {
file, err := ioutil.TempFile("", "asset*"+filepath.Ext(url))
file, err := os.CreateTemp("", "asset*"+filepath.Ext(url))
if err != nil {
fmt.Println("Error temp file", err)
return "", err
Expand Down
6 changes: 3 additions & 3 deletions go/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package openapi

import (
"encoding/json"
"io/ioutil"
"io"
"mime/multipart"
"net/http"
"os"
Expand Down Expand Up @@ -124,12 +124,12 @@ func readFileHeaderToTempFile(fileHeader *multipart.FileHeader) (*os.File, error

defer formFile.Close()

fileBytes, err := ioutil.ReadAll(formFile)
fileBytes, err := io.ReadAll(formFile)
if err != nil {
return nil, err
}

file, err := ioutil.TempFile("", fileHeader.Filename)
file, err := os.CreateTemp("", fileHeader.Filename)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit ba86732

Please sign in to comment.