Hello world example

This commit is contained in:
2026-03-15 21:40:28 +01:00
commit 86996b4887
3 changed files with 26 additions and 0 deletions

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module go_with_tests
go 1.26.1

11
hello.go Normal file
View File

@@ -0,0 +1,11 @@
package main
import "fmt"
func Hello(name string) string {
return "Hello, " + name
}
func main() {
fmt.Println(Hello("Hoborg"))
}

12
hello_test.go Normal file
View File

@@ -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)
}
}