Skip to content

Commit

Permalink
Merge pull request #122 from sashamelentyev/ioutil
Browse files Browse the repository at this point in the history
refactor: use io and friends instead deprecated ioutil
  • Loading branch information
ianchen0119 authored Feb 22, 2024
2 parents c182019 + 44ef2e8 commit b70ed87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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"
"gopkg.in/yaml.v2"
Expand All @@ -23,7 +23,7 @@ func InitConfigFactory(f string, cfg *Config) error {
f = AmfDefaultConfigPath
}

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 @@ -2,7 +2,7 @@ package service

import (
"fmt"
"io/ioutil"
"io"
"os"
"os/signal"
"runtime/debug"
Expand Down Expand Up @@ -50,15 +50,15 @@ func (a *AmfApp) 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 b70ed87

Please sign in to comment.