favor %w over %s for error wrapping

This commit is contained in:
vilmibm 2020-04-20 12:22:12 -05:00
parent e823ad0c6c
commit bd907ec74d
3 changed files with 7 additions and 7 deletions

View file

@ -132,7 +132,7 @@ func (c *fileConfig) Set(hostname, key, value string) error {
func (c *fileConfig) configForHost(hostname string) (*HostConfig, error) {
hosts, err := c.Hosts()
if err != nil {
return nil, fmt.Errorf("failed to parse hosts config: %s", err)
return nil, fmt.Errorf("failed to parse hosts config: %w", err)
}
for _, hc := range hosts {
@ -159,12 +159,12 @@ func (c *fileConfig) Hosts() ([]*HostConfig, error) {
_, hostsEntry, err := c.FindEntry("hosts")
if err != nil {
return nil, fmt.Errorf("could not find hosts config: %s", err)
return nil, fmt.Errorf("could not find hosts config: %w", err)
}
hostConfigs, err := c.parseHosts(hostsEntry)
if err != nil {
return nil, fmt.Errorf("could not parse hosts config: %s", err)
return nil, fmt.Errorf("could not parse hosts config: %w", err)
}
c.hosts = hostConfigs