From 86996b48872769f3f0af0427c7e0752144757cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krejczinger=20=C3=81rp=C3=A1d?= Date: Sun, 15 Mar 2026 21:40:28 +0100 Subject: [PATCH] Hello world example --- go.mod | 3 +++ hello.go | 11 +++++++++++ hello_test.go | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 go.mod create mode 100644 hello.go create mode 100644 hello_test.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d6b99b1 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module go_with_tests + +go 1.26.1 diff --git a/hello.go b/hello.go new file mode 100644 index 0000000..c72c826 --- /dev/null +++ b/hello.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func Hello(name string) string { + return "Hello, " + name +} + +func main() { + fmt.Println(Hello("Hoborg")) +} diff --git a/hello_test.go b/hello_test.go new file mode 100644 index 0000000..957b469 --- /dev/null +++ b/hello_test.go @@ -0,0 +1,12 @@ +package main + +import "testing" + +func TestHello(t *testing.T) { + got := Hello("Hoborg") + want := "Hello, Hoborg" + + if got != want { + t.Errorf("got %q want %q", got, want) + } +}