Address io/ioutil deprecation (#354)

pull/355/head^2
Julio Lopez 6 months ago committed by GitHub
parent 1fd1298c00
commit 228c96fcea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,6 @@
package fs
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -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 {

@ -3,7 +3,7 @@ package lsp
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
@ -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
}
@ -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
}

@ -3,7 +3,7 @@ package cmd
import (
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"time"
@ -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
}

Loading…
Cancel
Save