From 51a8422087c9fb920f15a32f2751471cf529088f Mon Sep 17 00:00:00 2001 From: Gzx1999 Date: Tue, 14 Dec 2021 14:14:21 +0800 Subject: [PATCH] remove dead code --- pkg/config/config.go | 4 +-- pkg/config/dev.yaml.templete | 16 ----------- pkg/configure/config.go | 20 -------------- pkg/configure/configure.go | 51 ------------------------------------ 4 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 pkg/config/dev.yaml.templete delete mode 100644 pkg/configure/config.go delete mode 100644 pkg/configure/configure.go diff --git a/pkg/config/config.go b/pkg/config/config.go index c4468fad..498bd82d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -78,13 +78,13 @@ func Init(output io.Writer, configFile string) error { } viper.WatchConfig() viper.OnConfigChange(func(e fsnotify.Event) { - _, _ = fmt.Fprintf(output, "Config file changed %s \n", e.Name) + fmt.Fprintf(output, "Config file changed %s \n", e.Name) }) return nil } func MustInit(output io.Writer, conf string) { // MustInit if fail panic if err := Init(output, conf); err != nil { - panic(fmt.Errorf("Fatal error config file: %s \n", err)) + panic(fmt.Errorf("fatal error config file: %s", err)) } } diff --git a/pkg/config/dev.yaml.templete b/pkg/config/dev.yaml.templete deleted file mode 100644 index acebcbad..00000000 --- a/pkg/config/dev.yaml.templete +++ /dev/null @@ -1,16 +0,0 @@ -server: - port: ":8083" -db: - ip: 192.168.160.18 - port: 3306 - username: "name" - password: "password" - dbname: pilotgo -log_opts: - log_level: "debug" - log_driver: "stdout" - log_path: "./log" - max_file: 1 - max_size: 10485760 -max_age: 1800, -session_count: 100 diff --git a/pkg/configure/config.go b/pkg/configure/config.go deleted file mode 100644 index 29bdcaf8..00000000 --- a/pkg/configure/config.go +++ /dev/null @@ -1,20 +0,0 @@ -package configure - -//import ( -// "github.com/spf13/viper" -//) -// -//const default_config_path = "config.yaml" -// -//type Config struct { -// v *viper.Viper -// configMap map[string]string -//} -// -//func (c *Config) Load() { -// -//} -// -//func (c *Config) Get(path string) string { -// return "" -//} diff --git a/pkg/configure/configure.go b/pkg/configure/configure.go deleted file mode 100644 index 6acf1325..00000000 --- a/pkg/configure/configure.go +++ /dev/null @@ -1,51 +0,0 @@ -package configure - -//import ( -// "encoding/json" -// "fmt" -// "io/ioutil" -//) -// -//var pilogo_config_file_name = "./config.json" -// -//type LogOpts struct { -// LogLevel string `json:"log_level"` -// LogDriver string `json:"log_driver"` -// LogPath string `json:"log_path"` -// MaxFile int `json:"max_file"` -// MaxSize int `json:"max_size"` -//} -//type Server struct { -// ServerPort int `json:"server_port"` -//} -//type DbInfo struct { -// HostName string `json:"host_name"` -// UserName string `json:"user_name"` -// Password string `json:"password"` -// DataBase string `json:"data_base"` -// Port int `json:"port"` -//} -// -//type Configure struct { -// Logopts LogOpts `json:"log_opts"` -// S Server `json:"server"` -// MaxAge int `json:"max_age"` -// SessionCount int `json:"session_count"` -// Dbinfo DbInfo `json:"db_info"` -//} -// -//func Load() (*Configure, error) { -// var config Configure -// bytes, err := ioutil.ReadFile(pilogo_config_file_name) -// if err != nil { -// fmt.Printf("open %s failed! err = %s\n", pilogo_config_file_name, err.Error()) -// return nil, err -// } -// -// err = json.Unmarshal(bytes, &config) -// if err != nil { -// fmt.Printf("json.Unmarshal %s failed!\n", string(bytes)) -// return nil, err -// } -// return &config, nil -//} -- Gitee