Hello, world!

This commit is contained in:
Ryan Richard 2020-07-02 17:05:59 -07:00
parent a3d64bef62
commit 911f8736f1
5 changed files with 41 additions and 0 deletions

3
.gitignore vendored
View File

@ -13,3 +13,6 @@
# Dependency directories (remove the comment below to include it)
# vendor/
# goland
.idea

View File

@ -0,0 +1,10 @@
package main
import (
"fmt"
"github.com/suzerain-io/placeholder-name/pkg/hello"
)
func main() {
fmt.Println(hello.NewHelloSayer().SayHello())
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/suzerain-io/placeholder-name
go 1.14

13
pkg/hello/hello.go Normal file
View File

@ -0,0 +1,13 @@
package hello
type HelloSayer interface {
SayHello() string
}
type helloSayerImpl struct{}
func (helloSayerImpl) SayHello() string { return "hello" }
func NewHelloSayer() HelloSayer {
return helloSayerImpl{}
}

12
pkg/hello/hello_test.go Normal file
View File

@ -0,0 +1,12 @@
package hello
import (
"testing"
)
func TestHelloSayerImpl_SayHello(t *testing.T) {
actualGreeting := NewHelloSayer().SayHello()
if actualGreeting != "hello" {
t.Errorf("expected to say hello but said %v", actualGreeting)
}
}