mirror of
https://github.com/costela/docker-etchosts.git
synced 2025-05-10 17:35:41 +02:00
merge calls to fmt.Fprintf
This commit is contained in:
parent
5eb23ea821
commit
2c93f8b233
1 changed files with 1 additions and 4 deletions
|
@ -90,10 +90,7 @@ func writeToEtcHosts(ipsToNames ipsToNamesMap, config ConfigSpec) error {
|
|||
func writeEntryWithBanner(tmp io.Writer, ip string, names []string) error {
|
||||
if len(names) > 0 {
|
||||
log.Debugf("writing entry for %s (%s)", ip, names)
|
||||
if _, err := fmt.Fprintf(tmp, "%s\n", banner); err != nil {
|
||||
return fmt.Errorf("error writing entry for %s: %s", ip, err)
|
||||
}
|
||||
if _, err := fmt.Fprintf(tmp, "%s\t%s\n", ip, strings.Join(names, " ")); err != nil {
|
||||
if _, err := fmt.Fprintf(tmp, "%s\n%s\t%s\n", banner, ip, strings.Join(names, " ")); err != nil {
|
||||
return fmt.Errorf("error writing entry for %s: %s", ip, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue