Procházet zdrojové kódy

refactor: rename NewConfig to LoadConfig

ayntgl před 4 roky
rodič
revize
4ac65d3cd7
2 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 1 1
      main.go
  2. 3 2
      util/config.go

+ 1 - 1
main.go

@@ -23,7 +23,7 @@ var (
 )
 
 func main() {
-	conf = util.NewConfig()
+	conf = util.LoadConfig()
 
 	tview.Borders.Horizontal = conf.Borders.Horizontal
 	tview.Borders.Vertical = conf.Borders.Vertical

+ 3 - 2
util/config.go

@@ -64,14 +64,15 @@ type Config struct {
 	Borders     borders     `toml:"borders"`
 }
 
-// NewConfig loads the configuration file, if the configuration file exists or creates a new one if not, and returns it.
-func NewConfig() *Config {
+// LoadConfig loads the configuration file, if the configuration file exists or creates a new one if not, and returns it.
+func LoadConfig() *Config {
 	configPath, err := os.UserConfigDir()
 	if err != nil {
 		panic(err)
 	}
 
 	configPath += "/discordo.toml"
+
 	var c Config
 	if _, err = os.Stat(configPath); os.IsNotExist(err) {
 		f, err := os.Create(configPath)