This commit is contained in:
Oliver Davies 2022-01-26 13:12:15 +00:00
parent b985c2d4ba
commit 77e6cc55b7
3 changed files with 21 additions and 2 deletions

3
go.mod Normal file
View file

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

View file

@ -2,6 +2,10 @@ package main
import "fmt"
func main() {
fmt.Println("Hello, world")
func Hello() string {
return "Hello, world"
}
func main() {
fmt.Println(Hello())
}

12
hello_test.go Normal file
View file

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