hello world

This commit is contained in:
Mike Bloy 2019-08-24 14:12:29 -05:00
parent 0cba8bfae5
commit 12b62ccee4
3 changed files with 26 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.bloy.org/mike/gotest
go 1.12

11
main.go Normal file
View File

@ -0,0 +1,11 @@
package main
import "fmt"
func main() {
fmt.Println(sayHi("Mike"))
}
func sayHi(name string) string {
return fmt.Sprintf("Hi %s", name)
}

12
main_test.go Normal file
View File

@ -0,0 +1,12 @@
package main
import "testing"
func TestSayHi(t *testing.T) {
expected := "Hi Testy"
greeting := sayHi("Testy")
if greeting != expected {
t.Errorf("Greeting was incorrect, got: '%s', want: '%s'",
greeting, expected)
}
}