Skip to content

Commit

Permalink
Address io/ioutil deprecation (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-lopez authored Nov 8, 2023
1 parent 1fd1298 commit 228c96f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions internal/adapter/fs/fs.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fs

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -114,7 +113,7 @@ func (fs *FileStorage) IsDescendantOf(dir string, path string) (bool, error) {
}

func (fs *FileStorage) Read(path string) ([]byte, error) {
return ioutil.ReadFile(path)
return os.ReadFile(path)
}

func (fs *FileStorage) Write(path string, content []byte) error {
Expand Down
6 changes: 3 additions & 3 deletions internal/adapter/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lsp
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -209,7 +209,7 @@ func NewServer(opts ServerOpts) *Server {

handler.CompletionItemResolve = func(context *glsp.Context, params *protocol.CompletionItem) (*protocol.CompletionItem, error) {
if path, ok := params.Data.(string); ok {
content, err := ioutil.ReadFile(path)
content, err := os.ReadFile(path)
if err != nil {
return params, err
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func NewServer(opts ServerOpts) *Server {
}
path = fs.Canonical(path)

contents, err := ioutil.ReadFile(path)
contents, err := os.ReadFile(path)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -36,7 +36,7 @@ func (cmd *New) Run(container *cli.Container) error {

var content []byte
if cmd.Interactive {
content, err = ioutil.ReadAll(os.Stdin)
content, err = io.ReadAll(os.Stdin)
if err != nil {
return err
}
Expand Down

0 comments on commit 228c96f

Please sign in to comment.