From f13632e4252a28bfc0b0372574f14f2eb57157b1 Mon Sep 17 00:00:00 2001 From: vinchent Date: Tue, 10 Sep 2024 11:09:31 +0200 Subject: [PATCH] hello %s --- hello.go | 6 +++--- hello_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hello.go b/hello.go index 68151e9..87014c6 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 fmt.Sprintf("Hello %s", name) } func main() { - fmt.Println(Hello()) + fmt.Println(Hello("Mary")) } diff --git a/hello_test.go b/hello_test.go index ca1b6cd..44226c0 100644 --- a/hello_test.go +++ b/hello_test.go @@ -3,8 +3,8 @@ package main import "testing" func TestHello(t *testing.T) { - got := Hello() - exp := "Hello world" + got := Hello("Jason") + exp := "Hello Jason" if got != exp { t.Errorf("got %q expected %q", got, exp) }