first hello module

This commit is contained in:
Fabio Montefuscolo 2024-03-18 17:30:03 +01:00
parent dfe937fc42
commit d5ab4eeb57
Signed by: fabiomontefuscolo
GPG key ID: B98DA1C6A4DE48B5
3 changed files with 26 additions and 0 deletions

3
hello/go.mod Normal file
View file

@ -0,0 +1,3 @@
module hello
go 1.22.1

11
hello/hello.go Normal file
View file

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

12
hello/hello_test.go Normal file
View file

@ -0,0 +1,12 @@
package main
import "testing"
func TestHello(t *testing.T) {
given := Hello()
expected := "Hello, world!"
if given != expected {
t.Errorf("given: %v, expected: %v", given, expected)
}
}