From ba7cf903155ccf87d953ccdc823091438f7190f7 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 7 Apr 2014 11:01:17 -0700 Subject: [PATCH] fix(manage_etc_hosts): Append newline to /etc/hosts --- initialize/manage_etc_hosts.go | 2 +- initialize/manage_etc_hosts_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/initialize/manage_etc_hosts.go b/initialize/manage_etc_hosts.go index 6632e5e..f168d98 100644 --- a/initialize/manage_etc_hosts.go +++ b/initialize/manage_etc_hosts.go @@ -22,7 +22,7 @@ func generateEtcHosts(option string) (out string, err error) { return "", err } - return fmt.Sprintf("%s %s", DefaultIpv4Address, hostname), nil + return fmt.Sprintf("%s %s\n", DefaultIpv4Address, hostname), nil } diff --git a/initialize/manage_etc_hosts_test.go b/initialize/manage_etc_hosts_test.go index 77f06bc..c73dfef 100644 --- a/initialize/manage_etc_hosts_test.go +++ b/initialize/manage_etc_hosts_test.go @@ -68,7 +68,7 @@ func TestEtcHostsWrittenToDisk(t *testing.T) { t.Fatalf("Unable to read OS hostname: %v", err) } - expect := fmt.Sprintf("%s %s", DefaultIpv4Address, hostname) + expect := fmt.Sprintf("%s %s\n", DefaultIpv4Address, hostname) if string(contents) != expect { t.Fatalf("File has incorrect contents")