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

remove deprecated io/ioutil #48

Merged
merged 1 commit into from
Nov 9, 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 govarnam/govarnam_ml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package govarnam

import (
"context"
"io/ioutil"
"log"
"path"
"strings"
Expand Down Expand Up @@ -377,7 +376,7 @@ func TestMLExportAndImport(t *testing.T) {
varnam.Export(exportFileIntendedPath, 300)

// read the whole file at once
b, err := ioutil.ReadFile(exportFilePath)
b, err := os.ReadFile(exportFilePath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file misses the import of "os"

if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions govarnam/govarnam_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package govarnam

import (
"io/ioutil"
"log"
"os"
"path"
Expand Down Expand Up @@ -104,7 +103,7 @@ func TestMain(m *testing.M) {
log.Fatal(err)
}

testTempDir, err = ioutil.TempDir("", "govarnam_test")
testTempDir, err = os.TempDir("", "govarnam_test")
checkError(err)

for _, schemeDetail := range schemeDetails {
Expand Down
5 changes: 2 additions & 3 deletions govarnam/learn.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
sql "database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"math"
"os"
Expand Down Expand Up @@ -624,7 +623,7 @@ func (varnam *Varnam) Export(filePath string, wordsPerFile int) error {
jsonData, err := json.Marshal(output)

filePathWithPageNumber := filePath + "-" + fmt.Sprint(page) + ".vlf"
err = ioutil.WriteFile(filePathWithPageNumber, jsonData, 0644)
err = os.WriteFile(filePathWithPageNumber, jsonData, 0644)
if err != nil {
return err
}
Expand All @@ -642,7 +641,7 @@ func (varnam *Varnam) Import(filePath string) error {
}

// TODO better reading of JSON. This loads entire file into memory
fileContent, _ := ioutil.ReadFile(filePath)
fileContent, _ := os.ReadFile(filePath)

var dbData exportFormat

Expand Down
3 changes: 1 addition & 2 deletions govarnamgo/govarnamgo_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package govarnamgo

import (
"io/ioutil"
"log"
"os"
"os/exec"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does this file

Expand Down Expand Up @@ -68,7 +67,7 @@ func tearDown() {

func TestMain(m *testing.M) {
var err error
testTempDir, err = ioutil.TempDir("", "govarnam_test")
testTempDir, err = os.TempDir("", "govarnam_test")
checkError(err)

setUp("ml")
Expand Down
Loading