From 11aa1735e13948cd5dc62a332a3d1fd56ebdc93f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 26 Jan 2022 13:29:00 +0000 Subject: [PATCH] Make the name dynamic --- hello.go | 6 +++--- hello_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hello.go b/hello.go index a53bfbb..a3ce470 100644 --- a/hello.go +++ b/hello.go @@ -2,10 +2,10 @@ package main import "fmt" -func Hello() string { - return "Hello, world" +func Hello(name string) string { + return "Hello, " + name } func main() { - fmt.Println(Hello()) + fmt.Println(Hello("Oliver")) } diff --git a/hello_test.go b/hello_test.go index 0531825..51a22a0 100644 --- a/hello_test.go +++ b/hello_test.go @@ -3,8 +3,8 @@ package main import "testing" func TestHello(t *testing.T) { - got := Hello() - want := "Hello, world" + got := Hello("Oliver") + want := "Hello, Oliver" if got != want { t.Errorf("got %q want %q", got, want)