From 631906ffd85ebf357e5ca3702625536f68ec0097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 21 Jul 2021 14:59:33 +0300 Subject: [PATCH] wip: go repositories --- WORKSPACE | 5 +++++ bin/mod-tidy | 11 +++++++++++ go.mod | 3 +++ repositories.bzl | 4 ++++ 4 files changed, 23 insertions(+) create mode 100755 bin/mod-tidy create mode 100644 go.mod create mode 100644 repositories.bzl diff --git a/WORKSPACE b/WORKSPACE index 715eb6f..e3dfd59 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -29,6 +29,11 @@ go_rules_dependencies() go_register_toolchains(version = "1.16") +load("//:repositories.bzl", "go_repositories") + +# gazelle:repository_macro repositories.bzl%go_repositories +go_repositories() + gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE") # protobuf is required for //:buildifier diff --git a/bin/mod-tidy b/bin/mod-tidy new file mode 100755 index 0000000..26091ca --- /dev/null +++ b/bin/mod-tidy @@ -0,0 +1,11 @@ +#!/bin/bash + +set -xeuo pipefail + +cd "$(git rev-parse --show-toplevel)" +bazel build @go_sdk//:go_sdk +bazel-bazel-zig-cc/external/go_sdk/bin/go mod tidy +exec bazel run //:gazelle -- update-repos \ + -from_file=go.mod \ + -prune \ + -to_macro=repositories.bzl%go_repositories diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..51be187 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/motiejus/bazel-zig-cc/test + +go 1.16 diff --git a/repositories.bzl b/repositories.bzl new file mode 100644 index 0000000..3696421 --- /dev/null +++ b/repositories.bzl @@ -0,0 +1,4 @@ +load("@bazel_gazelle//:deps.bzl", "go_repository") + +def go_repositories(): + pass