From 691dea67f033ac0e9edea02cee5ab59a400c28e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Fri, 4 Nov 2022 20:17:28 -0500 Subject: [PATCH 1/5] Added go support (without gazelle) and hello world example --- WORKSPACE | 17 +++++++++++++++++ go/BUILD | 9 +++++++++ go/main.go | 7 +++++++ 3 files changed, 33 insertions(+) create mode 100644 go/BUILD create mode 100644 go/main.go diff --git a/WORKSPACE b/WORKSPACE index c379ca98..64afafcf 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -122,3 +122,20 @@ maven_install( load("@maven//:compat.bzl", "compat_repositories") compat_repositories() + +rules_go_version = "v0.35.0" + +http_archive( + name = "io_bazel_rules_go", + sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.tar.gz".format(version = rules_go_version), + "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.tar.gz".format(version = rules_go_version), + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains(version = "1.17.2") \ No newline at end of file diff --git a/go/BUILD b/go/BUILD new file mode 100644 index 00000000..b788b86d --- /dev/null +++ b/go/BUILD @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary") + +go_binary( + name = "go", + srcs = glob([ + "*.go", + ]), + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/go/main.go b/go/main.go new file mode 100644 index 00000000..87595e3c --- /dev/null +++ b/go/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("hello world") +} From 012f9b42f1a1b98f1e0927a56bea6328bd06d1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 7 Nov 2022 15:56:55 -0500 Subject: [PATCH 2/5] Getting zip instead of tar.gz for bazel rules --- WORKSPACE | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 9ad0cd7d..f33de036 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -157,10 +157,10 @@ RULES_GO_VERSION = "v0.35.0" http_archive( name = "io_bazel_rules_go", - sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b", + sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.tar.gz".format(version = RULES_GO_VERSION), - "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.tar.gz".format(version = RULES_GO_VERSION), + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip", + "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip", ], ) @@ -168,4 +168,4 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe go_rules_dependencies() -go_register_toolchains(version = "1.17.2") +go_register_toolchains(version = "1.19.1") From 015a0a67b23b4ca6cd43b420b19c15dd3bb29771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Mon, 7 Nov 2022 15:59:28 -0500 Subject: [PATCH 3/5] Added format to string --- WORKSPACE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index f33de036..12e83590 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -159,8 +159,8 @@ http_archive( name = "io_bazel_rules_go", sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip", - "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip".format(version = RULES_GO_VERSION), + "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip".format(version = RULES_GO_VERSION), ], ) From a6bba12967c11d22286cb16bf12882bb452cfcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Tue, 8 Nov 2022 14:10:23 -0500 Subject: [PATCH 4/5] Using toolchains 1.19.3 Co-authored-by: Jay Conrod --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 12e83590..0ab2d3ff 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -168,4 +168,4 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe go_rules_dependencies() -go_register_toolchains(version = "1.19.1") +go_register_toolchains(version = "1.19.3") From 5254b5594954a9537b0d33f6d04977feb1a24980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco=20Santa?= Date: Tue, 8 Nov 2022 14:21:23 -0500 Subject: [PATCH 5/5] Inlining rules go version --- WORKSPACE | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 12e83590..d4667bb9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -153,14 +153,12 @@ scalatest_repositories() scalatest_toolchain() -RULES_GO_VERSION = "v0.35.0" - http_archive( name = "io_bazel_rules_go", sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip".format(version = RULES_GO_VERSION), - "https://github.com/bazelbuild/rules_go/releases/download/{version}/rules_go-{version}.zip".format(version = RULES_GO_VERSION), + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", ], )