Skip to content

Commit

Permalink
Bzlmod2 (#694)
Browse files Browse the repository at this point in the history
Move the bold repo from:
bazel 6.1.1, io_bazel_rules_go 0.46.0, bazel_gazelle 0.35.0, go1.21.8 using WORKSPACE
to:
bazel 7.3.2, rules_go 0.50.1, gazelle 0.39.1 , go1.23.2 using MODULE.bazel

There were quite a few hacks to remove and pieces to put in place to deal with current known issues in the rules_go (esp. nogo) code, but it's working!
  • Loading branch information
eljobe authored Oct 14, 2024
1 parent 4f9a9d6 commit 72d28cf
Show file tree
Hide file tree
Showing 70 changed files with 4,486 additions and 2,187 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.1
7.3.2
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.23.x
- name: Run Gosec Security Scanner
run: | # https://github.com/securego/gosec/issues/469
export PATH=$PATH:$(go env GOPATH)/bin
Expand All @@ -43,10 +43,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.23.x

- name: Golangci-lint
uses: golangci/golangci-lint-action@v6
Expand Down Expand Up @@ -76,10 +76,10 @@ jobs:
- name: Build solidity contracts
run: yarn --cwd contracts build

- name: Set up Go 1.21
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.23.x
id: go

- name: Install Foundry
Expand Down
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gazelle:ignore
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@io_bazel_rules_go//go:def.bzl", "TOOLS_NOGO", "nogo")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_go//go:def.bzl", "TOOLS_NOGO", "nogo")

# gazelle:prefix github.com/OffchainLabs/bold
gazelle(name = "gazelle")
Expand Down
41 changes: 41 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module(
name = "bold",
version = "0.0.1",
)

bazel_dep(name = "rules_go", version = "0.50.1")
bazel_dep(name = "gazelle", version = "0.39.1")
bazel_dep(name = "protobuf", version = "28.2")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.23.2")
go_sdk.nogo(nogo = "//:nogo")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
go_deps.module_override(
patch_strip = 1,
patches = [
"//third_party:com_github_ethereum_go_ethereum_secp256k1.patch",
],
path = "github.com/ethereum/go-ethereum",
)

# TODO: Remove when https://github.com/bazelbuild/rules_go/issues/4084 is resolved
go_deps.module(
path = "golang.org/x/tools",
# curl https://sum.golang.org/lookup/golang.org/x/[email protected]
sum = "h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=",
version = "v0.24.0",
)
use_repo(
go_deps,
"com_github_ethereum_go_ethereum",
"com_github_gorilla_mux",
"com_github_jmoiron_sqlx",
"com_github_mattn_go_sqlite3",
"com_github_pkg_errors",
"com_github_stretchr_testify",
"org_golang_x_sync",
"org_golang_x_tools",
)
4,323 changes: 4,323 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

48 changes: 0 additions & 48 deletions WORKSPACE

This file was deleted.

2 changes: 1 addition & 1 deletion api/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "api",
Expand Down
2 changes: 1 addition & 1 deletion api/backend/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "backend",
Expand Down
2 changes: 1 addition & 1 deletion api/db/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "db",
Expand Down
2 changes: 1 addition & 1 deletion api/server/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "server",
Expand Down
2 changes: 1 addition & 1 deletion assertions/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "assertions",
Expand Down
2 changes: 1 addition & 1 deletion chain-abstraction/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "protocol",
Expand Down
2 changes: 1 addition & 1 deletion chain-abstraction/sol-implementation/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "sol-implementation",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "challenge-manager",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/chain-watcher/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "chain-watcher",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/challenge-tree/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "challenge-tree",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/challenge-tree/mock/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "mock",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/edge-tracker/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "edge-tracker",
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/types/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "types",
Expand Down
2 changes: 1 addition & 1 deletion containers/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "containers",
Expand Down
2 changes: 1 addition & 1 deletion containers/events/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "events",
Expand Down
2 changes: 1 addition & 1 deletion containers/fsm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "fsm",
Expand Down
2 changes: 1 addition & 1 deletion containers/option/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "option",
Expand Down
2 changes: 1 addition & 1 deletion containers/threadsafe/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "threadsafe",
Expand Down
Loading

0 comments on commit 72d28cf

Please sign in to comment.