/
githubmirror
/
LeetCode-Go
Обзор
Документация
Войти
/
githubmirror
/
LeetCode-Go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
1.7.0
ctl/config.go
32 строки
507 B
YDZ
Ctl add build chapter-two
15 янв 2021, 17:32
15 янв 2021, 17:32
5b58e62
Код
Авторство
О чём код?
package main import ( "fmt" "log" "github.com/BurntSushi/toml" ) const ( configTOML = "config.toml" ) type config struct { Username string Password string Cookie string CSRFtoken string } func (c config) String() string { return fmt.Sprintf("Username: %s, Password: %s", c.Username, c.Password) } func getConfig() *config { cfg := new(config) if _, err := toml.DecodeFile(configTOML, &cfg); err != nil { log.Panicf(err.Error()) } // log.Printf("get config: %s", cfg) return cfg }