Skip to content

Warnings are printed to STDOUT not STDERR #244

@41exio

Description

@41exio

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions