diff --git a/.gitignore b/.gitignore index 66fd13c9..2aaba826 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +# goland +.idea diff --git a/cmd/placeholder-name/main.go b/cmd/placeholder-name/main.go new file mode 100644 index 00000000..604baebc --- /dev/null +++ b/cmd/placeholder-name/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "fmt" + "github.com/suzerain-io/placeholder-name/pkg/hello" +) + +func main() { + fmt.Println(hello.NewHelloSayer().SayHello()) +} diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..390f10c4 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/suzerain-io/placeholder-name + +go 1.14 diff --git a/pkg/hello/hello.go b/pkg/hello/hello.go new file mode 100644 index 00000000..936c05b8 --- /dev/null +++ b/pkg/hello/hello.go @@ -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{} +} diff --git a/pkg/hello/hello_test.go b/pkg/hello/hello_test.go new file mode 100644 index 00000000..acfe64f4 --- /dev/null +++ b/pkg/hello/hello_test.go @@ -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) + } +}