utils: remove the config.go file
This commit is contained in:
parent
8463725b9c
commit
a115970e7e
@ -1,24 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetConfigFile(name string) (*os.File, error) {
|
||||
_, err := os.Stat(name)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
//create file
|
||||
file, err := os.Create(name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fail to create config file: %w", err)
|
||||
}
|
||||
return file, err
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return os.OpenFile(name, os.O_RDWR, 0644)
|
||||
}
|
Loading…
Reference in New Issue
Block a user