diff --git a/go/go.mod b/go/go.mod new file mode 100644 index 0000000..fcb18b1 --- /dev/null +++ b/go/go.mod @@ -0,0 +1,3 @@ +module github.com/guardian/coding-exercise-project/go + +go 1.21 diff --git a/go/main.go b/go/main.go index 630d398..039bd26 100644 --- a/go/main.go +++ b/go/main.go @@ -1,7 +1,11 @@ package main -import "./src" +import ( + "fmt" + + "github.com/guardian/coding-exercise-project/go/src" +) func main() { - println(pairing.SayHello()) + fmt.Println(pairing.SayHello()) } diff --git a/go/script/test b/go/script/test index 1a21bbb..5cae49c 100755 --- a/go/script/test +++ b/go/script/test @@ -1,9 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -pushd src +cd "$(dirname "${BASH_SOURCE[0]}")/.." -go test - -popd +go test ./... diff --git a/go/src/pairing.go b/go/src/pairing.go index 8931531..9d8cffb 100644 --- a/go/src/pairing.go +++ b/go/src/pairing.go @@ -1,5 +1,5 @@ package pairing func SayHello() string { - return "hi" + return "hello" } diff --git a/go/src/pairing_test.go b/go/src/pairing_test.go index bb74fa3..f6402de 100644 --- a/go/src/pairing_test.go +++ b/go/src/pairing_test.go @@ -2,12 +2,8 @@ package pairing import "testing" -func TestNothing(t *testing.T) { - t.Skip("no implemented") -} - func TestSimpleString(t *testing.T) { - if SayHello() != "hello" { - t.Error("couldn't get hello message") - } + if SayHello() != "hello" { + t.Error("couldn't get hello message") + } }