Skip to content

Commit

Permalink
fix slice var declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
dhontecillas committed Sep 3, 2024
1 parent 9693325 commit bc072f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/hex"
"errors"
"io"
"io/ioutil"
"os"

"github.com/luraproject/lura/v2/config"
"github.com/luraproject/lura/v2/logging"
Expand All @@ -29,7 +29,7 @@ type SourceLoader interface {
Get(string) (string, bool)
}

func Parse(l logging.Logger, e config.ExtraConfig, namespace string) (Config, error) {
func Parse(l logging.Logger, e config.ExtraConfig, namespace string) (Config, error) { // skipcq: GO-R1005
res := Config{}
v, ok := e[namespace]
if !ok {
Expand All @@ -54,7 +54,7 @@ func Parse(l logging.Logger, e config.ExtraConfig, namespace string) (Config, er

sources, ok := c["sources"].([]interface{})
if ok {
s := []string{}
s := make([]string, 0, len(sources))
for _, source := range sources {
if t, ok := source.(string); ok {
s = append(s, t)
Expand All @@ -71,7 +71,7 @@ func Parse(l logging.Logger, e config.ExtraConfig, namespace string) (Config, er
loader := map[string]string{}

for _, source := range res.Sources {
b, err := ioutil.ReadFile(source)
b, err := os.ReadFile(source)
if err != nil {
l.Error("[Lua] Opening the source file:", err.Error())
continue
Expand Down Expand Up @@ -120,7 +120,7 @@ func (o onceLoader) Get(k string) (string, bool) {
type liveLoader struct{}

func (liveLoader) Get(k string) (string, bool) {
b, err := ioutil.ReadFile(k)
b, err := os.ReadFile(k)
if err != nil {
return "", false
}
Expand Down

0 comments on commit bc072f1

Please sign in to comment.