commit 86996b48872769f3f0af0427c7e0752144757cdd Author: Krejczinger Árpád Date: Sun Mar 15 21:40:28 2026 +0100 Hello world example 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) + } +}