Hello world example
This commit is contained in:
11
hello.go
Normal file
11
hello.go
Normal 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
12
hello_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user