From ecb9f584d879eb0692b7dc4561d3e81d3ad83402 Mon Sep 17 00:00:00 2001 From: ilia Date: Thu, 16 Apr 2026 01:45:49 +0000 Subject: [PATCH] feat: initial Go project with test --- go.mod | 3 +++ main.go | 11 +++++++++++ main_test.go | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 go.mod create mode 100644 main.go create mode 100644 main_test.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ab6c52c --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module test-go-project + +go 1.22 diff --git a/main.go b/main.go new file mode 100644 index 0000000..0daf0f5 --- /dev/null +++ b/main.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello from Forgejo!") +} + +func Add(a, b int) int { + return a + b +} diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..cceec2f --- /dev/null +++ b/main_test.go @@ -0,0 +1,9 @@ +package main + +import "testing" + +func TestAdd(t *testing.T) { + if got := Add(2, 3); got != 5 { + t.Errorf("Add(2, 3) = %d, want 5", got) + } +}