From 1afba52f93191ca823c8812c832e1895b698b558 Mon Sep 17 00:00:00 2001 From: Tony Bai Date: Mon, 3 Apr 2023 15:38:07 +0800 Subject: [PATCH] add module-path-main --- module-path-main/go.mod | 3 +++ module-path-main/pkg.go | 5 +++++ module-path-main/pkg_test.go | 12 ++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 module-path-main/go.mod create mode 100644 module-path-main/pkg.go create mode 100644 module-path-main/pkg_test.go diff --git a/module-path-main/go.mod b/module-path-main/go.mod new file mode 100644 index 00000000..1e03b320 --- /dev/null +++ b/module-path-main/go.mod @@ -0,0 +1,3 @@ +module main + +go 1.20 diff --git a/module-path-main/pkg.go b/module-path-main/pkg.go new file mode 100644 index 00000000..23a7f59e --- /dev/null +++ b/module-path-main/pkg.go @@ -0,0 +1,5 @@ +package main + +func Add(a, b int) int { + return a + b +} diff --git a/module-path-main/pkg_test.go b/module-path-main/pkg_test.go new file mode 100644 index 00000000..c3105f89 --- /dev/null +++ b/module-path-main/pkg_test.go @@ -0,0 +1,12 @@ +package main + +import ( + "testing" +) + +func TestAdd(t *testing.T) { + n := Add(5, 6) + if n != 11 { + t.Errorf("want 11, got %d\n", n) + } +}