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 package fs
import ( import (
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -114,7 +113,7 @@ func (fs *FileStorage) IsDescendantOf(dir string, path string) (bool, error) {
} }
func (fs *FileStorage) Read(path string) ([]byte, 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 { func (fs *FileStorage) Write(path string, content []byte) error {

@ -3,7 +3,7 @@ package lsp
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@ -209,7 +209,7 @@ func NewServer(opts ServerOpts) *Server {
handler.CompletionItemResolve = func(context *glsp.Context, params *protocol.CompletionItem) (*protocol.CompletionItem, error) { handler.CompletionItemResolve = func(context *glsp.Context, params *protocol.CompletionItem) (*protocol.CompletionItem, error) {
if path, ok := params.Data.(string); ok { if path, ok := params.Data.(string); ok {
content, err := ioutil.ReadFile(path) content, err := os.ReadFile(path)
if err != nil { if err != nil {
return params, err return params, err
} }
@ -250,7 +250,7 @@ func NewServer(opts ServerOpts) *Server {
} }
path = fs.Canonical(path) path = fs.Canonical(path)
contents, err := ioutil.ReadFile(path) contents, err := os.ReadFile(path)
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -3,7 +3,7 @@ package cmd
import ( import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"os" "os"
"path/filepath" "path/filepath"
"time" "time"
@ -36,7 +36,7 @@ func (cmd *New) Run(container *cli.Container) error {
var content []byte var content []byte
if cmd.Interactive { if cmd.Interactive {
content, err = ioutil.ReadAll(os.Stdin) content, err = io.ReadAll(os.Stdin)
if err != nil { if err != nil {
return err return err
} }

Loading…
Cancel
Save