Skip to content

go: Fix build: add go.mod, proper imports, and make test pass - #162

Open
adamnfish-gu wants to merge 1 commit into
platform/tool-versions-cifrom
fix/go
Open

go: Fix build: add go.mod, proper imports, and make test pass#162
adamnfish-gu wants to merge 1 commit into
platform/tool-versions-cifrom
fix/go

Conversation

@adamnfish-gu

@adamnfish-gu adamnfish-gu commented Aug 7, 2026

Copy link
Copy Markdown

The project did not build:

  • No go.mod, so the GOPATH-era relative import "./src" in main.go was rejected.
  • SayHello() returned "hi" but TestSimpleString expected "hello".

Adds go.mod with module path github.com/guardian/coding-exercise-project/go, switches main.go to the module-qualified import, and returns "hello" from SayHello(). script/test runs go test ./... from the module root rather than pushd src && go test.

Removes TestNothing, a t.Skip stub. Replaces the println builtin, which writes to stderr, with fmt.Println.


Base platform/tool-versions-ci (#144), so the diff shows only this branch's changes. Merge #144 first.

Part of #143.

The project did not build:
- No go.mod, so the GOPATH-era relative import "./src" in main.go was
  rejected.
- SayHello() returned "hi" but TestSimpleString expected "hello".

Adds go.mod with module path github.com/guardian/coding-exercise-project/go,
switches main.go to the module-qualified import, and returns "hello" from
SayHello(). script/test runs `go test ./...` from the module root rather than
`pushd src && go test`.

Removes TestNothing, a t.Skip stub. Replaces the println builtin, which
writes to stderr, with fmt.Println.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant