cli icon indicating copy to clipboard operation
cli copied to clipboard

Warnings are printed to STDOUT not STDERR

Open 41exio opened this issue 1 month ago • 0 comments

In ipinfo/init.go and ipinfo/ipinfo_client.go warnings are printed to STDOUT:

func init() {
	if err := InitConfig(); err != nil {
		fmt.Println("warn: error in creating config file.")
	}
}
	if gConfig.CacheEnabled && !fNoCache {
		boltdbCache, err := NewBoltdbCache()
		if err != nil {
			fmt.Printf("warn: cache will not be used: %v", err)
		} else {
			cache = ipinfo.NewCache(boltdbCache)
		}
	}

The expected behaviour is that all error messages and diagnostics are on STDERR where STDOUT is reserved for "normal output".

This behaviour was observed when I was using info cidr2ip as part of a pipeline but it would sporadically fail because sometimes the config file fails to be created and "warn: error in creating config file" is injected into the list of expanded CIDR ranges.

Thanks!

41exio avatar Nov 20 '25 11:11 41exio