From d3fee586305d04acf66c4af955a169e2554378d6 Mon Sep 17 00:00:00 2001
From: Bo-Yi Wu <appleboy.tw@gmail.com>
Date: Sun, 18 Feb 2024 15:00:12 +0800
Subject: [PATCH] chore: refactor Go projects and update CI configs

- Update Go versions in CI workflow to include 1.20, 1.21, and 1.22, and remove versions below 1.18
- Change directory structure for tests in `example36-performance` and `example52-ring-buffer-queue`
- Add `go.mod` file for `example36-performance` with Go version 1.21.4
- Create `go.mod` file for `example52-ring-buffer-queue` specifying Go version 1.21.4 and dependencies
- Introduce `go.sum` for `example52-ring-buffer-queue` with checksums for dependencies

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
---
 .github/workflows/go.yml           |  6 +++---
 example36-performance/go.mod       |  3 +++
 example52-ring-buffer-queue/go.mod | 11 +++++++++++
 example52-ring-buffer-queue/go.sum | 10 ++++++++++
 4 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 example36-performance/go.mod
 create mode 100644 example52-ring-buffer-queue/go.mod
 create mode 100644 example52-ring-buffer-queue/go.sum

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 2f1ff66..2196f18 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -13,7 +13,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest]
-        go: [1.14, 1.15, 1.16, 1.17, 1.18, 1.19]
+        go: [1.18, 1.19, "1.20", 1.21, 1.22]
     name: ${{ matrix.os }} @ Go ${{ matrix.go }}
     runs-on: ${{ matrix.os }}
     env:
@@ -32,5 +32,5 @@ jobs:
 
       - name: Run Testing
         run: |
-          go test -v -bench=. ./example36-performance/...
-          go test -v -run=^$ -benchmem -bench . ./example52-ring-buffer-queue/...
+          cd example36-performance && go test -v -bench=. ./...
+          cd example52-ring-buffer-queue && go test -v -run=^$ -benchmem -bench . ./...
diff --git a/example36-performance/go.mod b/example36-performance/go.mod
new file mode 100644
index 0000000..82d87b2
--- /dev/null
+++ b/example36-performance/go.mod
@@ -0,0 +1,3 @@
+module example
+
+go 1.21.4
diff --git a/example52-ring-buffer-queue/go.mod b/example52-ring-buffer-queue/go.mod
new file mode 100644
index 0000000..06b0495
--- /dev/null
+++ b/example52-ring-buffer-queue/go.mod
@@ -0,0 +1,11 @@
+module example
+
+go 1.21.4
+
+require github.com/stretchr/testify v1.8.4
+
+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/example52-ring-buffer-queue/go.sum b/example52-ring-buffer-queue/go.sum
new file mode 100644
index 0000000..fa4b6e6
--- /dev/null
+++ b/example52-ring-buffer-queue/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.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+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=