Skip to content

Commit

Permalink
fix: fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Apr 23, 2024
1 parent 8729cdc commit 01623fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions backend/billing/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package billing

import (
"io/ioutil"
"io"
"strconv"
"time"

Expand Down Expand Up @@ -52,7 +52,7 @@ func PullCDRFile(c *ftp.ServerConn, fileName string) ([]byte, error) {
return nil, err
}

cdr, err1 := ioutil.ReadAll(r)
cdr, err1 := io.ReadAll(r)

return cdr, err1
}
3 changes: 1 addition & 2 deletions backend/billing/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package billing

import (
"encoding/json"
"io/ioutil"
"os"
"strconv"
"sync"
Expand Down Expand Up @@ -79,7 +78,7 @@ func OpenServer(wg *sync.WaitGroup) *BillingDomain {
return nil
}

if err := ioutil.WriteFile(confFile, file, 0o600); err != nil { //nolint: gomnd
if err := os.WriteFile(confFile, file, 0o600); err != nil { //nolint: gomnd
logger.BillingLog.Errorf("Couldn't create conf file %v", confFile)
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions backend/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package factory

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

"github.com/asaskevich/govalidator"
"gopkg.in/yaml.v2"
Expand All @@ -22,7 +22,7 @@ func InitConfigFactory(f string, cfg *Config) error {
// Use default config path
f = WebuiDefaultConfigPath
}
if content, err := ioutil.ReadFile(f); err != nil {
if content, err := os.ReadFile(f); err != nil {
return fmt.Errorf("[Factory] %+v", err)
} else {
logger.CfgLog.Infof("Read config from [%s]", f)
Expand Down
6 changes: 3 additions & 3 deletions backend/webui_service/webui_init.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package webui_service

import (
"io/ioutil"
"io"
"os"
"os/signal"
"runtime/debug"
Expand Down Expand Up @@ -39,14 +39,14 @@ func (a *WebuiApp) SetLogEnable(enable bool) {
logger.MainLog.Infof("Log enable is set to [%v]", enable)
if enable && logger.Log.Out == os.Stderr {
return
} else if !enable && logger.Log.Out == ioutil.Discard {
} else if !enable && logger.Log.Out == io.Discard {
return
}
a.cfg.SetLogEnable(enable)
if enable {
logger.Log.SetOutput(os.Stderr)
} else {
logger.Log.SetOutput(ioutil.Discard)
logger.Log.SetOutput(io.Discard)
}
}

Expand Down

0 comments on commit 01623fb

Please sign in to comment.