Skip to content
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
6 changes: 3 additions & 3 deletions antlr/GruleParserV3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package antlr

import (
"fmt"
"io/ioutil"
"os"
"reflect"
"testing"

Expand Down Expand Up @@ -105,7 +105,7 @@ type GrandChild struct {
}

func TestV3Lexer(t *testing.T) {
data, err := ioutil.ReadFile("./sample4.grl")
data, err := os.ReadFile("./sample4.grl")
if err != nil {
t.Fatal(err)
} else {
Expand All @@ -129,7 +129,7 @@ func TestV3Lexer(t *testing.T) {

func TestV3Parser(t *testing.T) {
// logrus.SetLevel(logrus.TraceLevel)
data, err := ioutil.ReadFile("./sample4.grl")
data, err := os.ReadFile("./sample4.grl")
if err != nil {
t.Fatal(err)
} else {
Expand Down
4 changes: 2 additions & 2 deletions editor/EvaluationRoute.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hyperjumptech/grule-rule-engine/engine"
"github.com/hyperjumptech/grule-rule-engine/pkg"
mux "github.com/hyperjumptech/hyper-mux"
"io/ioutil"
"io"
"net/http"
)

Expand All @@ -25,7 +25,7 @@ type EvaluateRequest struct {

func InitializeEvaluationRoute(router *mux.HyperMux) {
router.AddRoute("/evaluate", http.MethodPost, func(writer http.ResponseWriter, reader *http.Request) {
bodyBytes, err := ioutil.ReadAll(reader.Body)
bodyBytes, err := io.ReadAll(reader.Body)
if err != nil {
writer.WriteHeader(http.StatusInternalServerError)
_, _ = writer.Write([]byte(fmt.Sprintf("error while reading body stream. got %v", err)))
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/ExecRules_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/hyperjumptech/grule-rule-engine/builder"
"github.com/hyperjumptech/grule-rule-engine/engine"
"github.com/hyperjumptech/grule-rule-engine/pkg"
"io/ioutil"
"os"
"testing"
)

Expand Down Expand Up @@ -66,7 +66,7 @@ func Benchmark_Grule_Execution_Engine(b *testing.B) {
}

func load100RulesIntoKnowledgebase() {
input, _ := ioutil.ReadFile("100_rules.grl")
input, _ := os.ReadFile("100_rules.grl")
rules := string(input)
fact := &RideFact{
Distance: 6000,
Expand All @@ -83,7 +83,7 @@ func load100RulesIntoKnowledgebase() {
}

func load1000RulesIntoKnowledgebase() {
input, _ := ioutil.ReadFile("1000_rules.grl")
input, _ := os.ReadFile("1000_rules.grl")
rules := string(input)
fact := &RideFact{
Distance: 6000,
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/LoadRules_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/hyperjumptech/grule-rule-engine/ast"
"github.com/hyperjumptech/grule-rule-engine/builder"
"github.com/hyperjumptech/grule-rule-engine/pkg"
"io/ioutil"
"os"
"testing"
)

Expand Down Expand Up @@ -58,7 +58,7 @@ func Benchmark_Grule_Load_Rules(b *testing.B) {
}

func load100RulesIntoKnowledgeBase() {
input, _ := ioutil.ReadFile("100_rules.grl")
input, _ := os.ReadFile("100_rules.grl")
rules := string(input)
fact := &RideFact{
Distance: 6000,
Expand All @@ -74,7 +74,7 @@ func load100RulesIntoKnowledgeBase() {
}

func load1000RulesIntoKnowledgeBase() {
input, _ := ioutil.ReadFile("1000_rules.grl")
input, _ := os.ReadFile("1000_rules.grl")
rules := string(input)
fact := &RideFact{
Distance: 6000,
Expand Down
14 changes: 7 additions & 7 deletions pkg/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"time"

Expand Down Expand Up @@ -59,7 +59,7 @@ type ReaderResource struct {
// Load will load the resource into byte array.
func (res *ReaderResource) Load() ([]byte, error) {

return ioutil.ReadAll(res.Reader)
return io.ReadAll(res.Reader)
}

// String will state the resource source.
Expand Down Expand Up @@ -124,7 +124,7 @@ func (bundle *FileResourceBundle) MustLoad() []Resource {
func (bundle *FileResourceBundle) loadPath(path string) ([]Resource, error) {
logger.Log.Tracef("Enter directory %s", path)

finfos, err := ioutil.ReadDir(path)
finfos, err := os.ReadDir(path)

if err != nil {

Expand All @@ -148,7 +148,7 @@ func (bundle *FileResourceBundle) loadPath(path string) ([]Resource, error) {
}
if matched {
logger.Log.Debugf("Loading file %s", fulPath)
bytes, err := ioutil.ReadFile(fulPath)
bytes, err := os.ReadFile(fulPath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (res *FileResource) Load() ([]byte, error) {

return res.Bytes, nil
}
data, err := ioutil.ReadFile(res.Path)
data, err := os.ReadFile(res.Path)
if err != nil {

return nil, err
Expand Down Expand Up @@ -280,7 +280,7 @@ func (res *URLResource) Load() ([]byte, error) {
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {

return nil, err
Expand Down Expand Up @@ -360,7 +360,7 @@ func (bundle *GITResourceBundle) loadPath(url, path string, fileSyst billy.Files

return nil, err
}
bytes, err := ioutil.ReadAll(f)
bytes, err := io.ReadAll(f)
if err != nil {

return nil, err
Expand Down
Loading