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 15, 2024
1 parent 5722cd6 commit 0173214
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"math"
"math/big"
"net"
"os"
"strings"
"sync"

Expand Down Expand Up @@ -178,7 +178,7 @@ func InitN3IWFContext() bool {
keyPath = factory.N3iwfConfig.Configuration.PrivateKey
}

content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read private key data from file: %+v", err)
return false
Expand Down Expand Up @@ -220,7 +220,7 @@ func InitN3IWFContext() bool {
}

// Read .pem
content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read certificate authority data from file: %+v", err)
return false
Expand Down Expand Up @@ -259,7 +259,7 @@ func InitN3IWFContext() bool {
}

// Read .pem
content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read certificate data from file: %+v", err)
return false
Expand Down
4 changes: 2 additions & 2 deletions pkg/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"
yaml "gopkg.in/yaml.v2"
Expand All @@ -23,7 +23,7 @@ func InitConfigFactory(f string, cfg *Config) error {
f = N3iwfDefaultConfigPath
}

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 pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package service
import (
"context"
"fmt"
"io/ioutil"
"io"
"net"
"os"
"os/signal"
Expand Down Expand Up @@ -43,15 +43,15 @@ func (a *N3iwfApp) 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 0173214

Please sign in to comment.