print error

This commit is contained in:
Roy Olav Purser 2021-03-23 13:05:27 +01:00
parent 9ebfbbf77a
commit 297f72dd97
No known key found for this signature in database
GPG Key ID: 0BA77797F072BC52

View File

@ -80,6 +80,7 @@ func (c *Config) DefineDefault(key string, val string, dtype DataType) {
} }
func (c *Config) Parse() { func (c *Config) Parse() {
c.parsed = true
parsers := make(map[DataType](func(string)(cValue))) parsers := make(map[DataType](func(string)(cValue)))
parsers[TypeInt] = parseInt parsers[TypeInt] = parseInt
parsers[TypeDuration] = parseDuration parsers[TypeDuration] = parseDuration
@ -98,6 +99,13 @@ func (c *Config) Parse() {
} }
} }
func (c *Config) Show() {
for _,v := range c.env {
fmt.Println(v.parsed.err)
}
}
func parseInt(str string)(ret cValue) { func parseInt(str string)(ret cValue) {
ret.intval, ret.err = strconv.ParseInt(str, 10, 64) ret.intval, ret.err = strconv.ParseInt(str, 10, 64)
return return