From cd0ebb1282997d08f335d88d29ed6c768c044ba4 Mon Sep 17 00:00:00 2001
From: ehlui <86680816+ehlui@users.noreply.github.com>
Date: Sat, 16 Dec 2023 00:23:43 +0100
Subject: [PATCH] Adding Go migration Candidate

---
 .../io/sdkman/changelogs/GoMigrations.scala   | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 src/main/scala/io/sdkman/changelogs/GoMigrations.scala

diff --git a/src/main/scala/io/sdkman/changelogs/GoMigrations.scala b/src/main/scala/io/sdkman/changelogs/GoMigrations.scala
new file mode 100644
index 00000000..f8853120
--- /dev/null
+++ b/src/main/scala/io/sdkman/changelogs/GoMigrations.scala
@@ -0,0 +1,68 @@
+package io.sdkman.changelogs
+
+import com.github.mongobee.changeset.{ChangeLog, ChangeSet}
+import com.mongodb.client.MongoDatabase
+
+@ChangeLog(order = "080")
+class GoMigrations {
+
+  @ChangeSet(
+    order = "001",
+    id = "001_add_go_candidate",
+    author = "ehlui"
+  )
+  def migration001(implicit db: MongoDatabase) =
+    Candidate(
+      candidate = "go",
+      name = "Go",
+      description =
+        "An open-source programming language supported by Google." +
+          "Easy to learn and great for teams. Built-in concurrency and a robust standard library." +
+          "Large ecosystem ... ",
+      websiteUrl = "https://go.dev/"
+    ).insert()
+
+  @ChangeSet(
+    order = "002",
+    id = "002_add_go_1_x_y",
+    author = "ehlui"
+  )
+  def migration002(implicit db: MongoDatabase): Unit =
+    Seq("1.21.5", "1.20.12", "1.19.13", "1.19")
+      .foreach { version =>
+        removeVersion("go", version)
+        List(
+          Version(
+            candidate = "go",
+            version = version,
+            url = s"https://go.dev/dl/go$version.linux-amd64.tar.gz",
+            platform = Linux64
+          ),
+          Version(
+            candidate = "go",
+            version = version,
+            url = s"https://go.dev/dl/go$version.linux-arm64.tar.gz",
+            platform = LinuxARM64
+          ),
+          Version(
+            candidate = "go",
+            version = version,
+            url = s"https://go.dev/dl/go$version.linux-amd64.tar.gz",
+            platform = MacOSX
+          ),
+          Version(
+            candidate = "go",
+            version = version,
+            url = s"https://go.dev/dl/go$version.darwin-arm64.tar.gz",
+            platform = MacARM64
+          ),
+          Version(
+            candidate = "go",
+            version = version,
+            url = s"https://go.dev/dl/go$version.windows-amd64.zip",
+            platform = Windows
+          )
+        ).validate()
+          .insert()
+      }
+}