From 8e36cee8af238a963e0c201c99debf9898d7cbb9 Mon Sep 17 00:00:00 2001 From: Slayder12 Date: Tue, 2 Dec 2025 14:32:08 +0300 Subject: [PATCH] initial --- .github/workflows/tests.yml | 25 +++++++++++++++++++++++++ go.mod | 11 +++++++++++ go.sum | 10 ++++++++++ main.go | 15 +++++++++++++++ testfunc_test.go | 26 ++++++++++++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go create mode 100644 testfunc_test.go diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..166983f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,25 @@ +name: Go + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: [1.25.x] + + - name: Install dependencies + run: go mod tidy + + - name: Build + run: go build . + + - name: Test + run: go test -v ./... + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ea41ac3 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module giteatest + +go 1.25.4 + +require github.com/stretchr/testify v1.11.1 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c4c1710 --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go new file mode 100644 index 0000000..14dd232 --- /dev/null +++ b/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(hello()) +} + +func hello() string { + return "Hello go" +} + + diff --git a/testfunc_test.go b/testfunc_test.go new file mode 100644 index 0000000..f18f720 --- /dev/null +++ b/testfunc_test.go @@ -0,0 +1,26 @@ +package main + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestHello(t *testing.T) { + tests := []struct { + name string + want string + }{ + { + name: "basic test - returns correct greeting", + want: "Hello go", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := hello() + require.Equal(t, tt.want, got, "hello() should return expected string") + }) + } +} \ No newline at end of file