From 44ef2e8dc9dca97f02dd4a85367507127b0455a8 Mon Sep 17 00:00:00 2001 From: Sasha Melentyev Date: Sun, 18 Feb 2024 12:53:11 +0300 Subject: [PATCH] refactor: use io and friends instead deprecated ioutil Signed-off-by: Sasha Melentyev --- pkg/factory/factory.go | 4 ++-- pkg/service/init.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/factory/factory.go b/pkg/factory/factory.go index 52f3c0ae..15d6fa70 100644 --- a/pkg/factory/factory.go +++ b/pkg/factory/factory.go @@ -6,7 +6,7 @@ package factory import ( "fmt" - "io/ioutil" + "os" "github.com/asaskevich/govalidator" "gopkg.in/yaml.v2" @@ -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) diff --git a/pkg/service/init.go b/pkg/service/init.go index 82e79342..00de516a 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -2,7 +2,7 @@ package service import ( "fmt" - "io/ioutil" + "io" "os" "os/signal" "runtime/debug" @@ -50,7 +50,7 @@ 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 } @@ -58,7 +58,7 @@ func (a *AmfApp) SetLogEnable(enable bool) { if enable { logger.Log.SetOutput(os.Stderr) } else { - logger.Log.SetOutput(ioutil.Discard) + logger.Log.SetOutput(io.Discard) } }