Hello, world!
This commit is contained in:
parent
a3d64bef62
commit
911f8736f1
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,3 +13,6 @@
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# goland
|
||||
.idea
|
||||
|
10
cmd/placeholder-name/main.go
Normal file
10
cmd/placeholder-name/main.go
Normal 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
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/suzerain-io/placeholder-name
|
||||
|
||||
go 1.14
|
13
pkg/hello/hello.go
Normal file
13
pkg/hello/hello.go
Normal 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
12
pkg/hello/hello_test.go
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user