Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address io/ioutil deprecation #354

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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