Skip to content

Commit c1499b5

Browse files
authored
refactor: single go.mod file (#10)
* refactor: single go.mod file * keep test makefile test task on package level
1 parent a97f346 commit c1499b5

File tree

8 files changed

+105
-559
lines changed

8 files changed

+105
-559
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Local environment
18+
.env
19+
20+
# Build files
21+
op-translator
22+
bin/
23+
generated/
24+
openapi/
25+
26+
# Hot Reload (Air)
27+
tmp
28+
29+
# Internal files
30+
internal/.DS_Store
31+
.DS_Store
32+
.vscode

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
test:
2+
go test -v ./...
3+
.PHONY: test
4+
5+
lint:
6+
golangci-lint run --timeout=10m --config=.golangci.yaml --allow-parallel-runners
7+
.PHONY: lint
8+
9+
lint-fix:
10+
golangci-lint run --timeout=10m --config=.golangci.yaml --allow-parallel-runners --fix
11+
.PHONY: lint-fix
12+
13+
format:
14+
go fmt ./...
15+
.PHONY: format
16+
17+
build:
18+
op-translator metabased-publisher
19+
.PHONY: build
20+
21+
op-translator:
22+
make -C ./op-translator op-translator
23+
.PHONY: op-translator
24+
25+
metabased-publisher:
26+
make -C ./metabased-publisher metabased-publisher
27+
.PHONY: metabased-publisher

op-translator/go.mod renamed to go.mod

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/SyndicateProtocol/metabased-rollup/op-translator
1+
module github.com/SyndicateProtocol/metabased-rollup
22

33
go 1.23.0
44

@@ -13,16 +13,21 @@ require (
1313
github.com/rs/zerolog v1.33.0
1414
github.com/spf13/pflag v1.0.5
1515
github.com/stretchr/testify v1.9.0
16+
github.com/urfave/cli/v2 v2.27.4
1617
)
1718

1819
require (
1920
github.com/BurntSushi/toml v1.4.0 // indirect
2021
github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e // indirect
2122
github.com/Microsoft/go-winio v0.6.2 // indirect
23+
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
2224
github.com/andybalholm/brotli v1.1.0 // indirect
2325
github.com/beorn7/perks v1.0.1 // indirect
2426
github.com/bits-and-blooms/bitset v1.10.0 // indirect
27+
github.com/btcsuite/btcd v0.24.2 // indirect
2528
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
29+
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
30+
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
2631
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2732
github.com/cockroachdb/errors v1.11.3 // indirect
2833
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
@@ -38,6 +43,7 @@ require (
3843
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3944
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
4045
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
46+
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 // indirect
4147
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac // indirect
4248
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
4349
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
@@ -53,6 +59,7 @@ require (
5359
github.com/gorilla/websocket v1.5.3 // indirect
5460
github.com/hashicorp/errwrap v1.1.0 // indirect
5561
github.com/hashicorp/go-bexpr v0.1.11 // indirect
62+
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
5663
github.com/holiman/uint256 v1.3.1 // indirect
5764
github.com/huin/goupnp v1.3.0 // indirect
5865
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
@@ -70,7 +77,6 @@ require (
7077
github.com/mitchellh/reflectwalk v1.0.2 // indirect
7178
github.com/mmcloughlin/addchain v0.4.0 // indirect
7279
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
73-
github.com/nxadm/tail v1.4.11 // indirect
7480
github.com/olekukonko/tablewriter v0.0.5 // indirect
7581
github.com/pkg/errors v0.9.1 // indirect
7682
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -88,7 +94,7 @@ require (
8894
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
8995
github.com/tklauser/go-sysconf v0.3.12 // indirect
9096
github.com/tklauser/numcpus v0.6.1 // indirect
91-
github.com/urfave/cli/v2 v2.27.4 // indirect
97+
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
9298
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
9399
github.com/yusufpapurcu/wmi v1.2.3 // indirect
94100
golang.org/x/crypto v0.27.0 // indirect

metabased-publisher/go.sum renamed to go.sum

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3
9494
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
9595
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
9696
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
97+
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827042333-110c433a2469 h1:sGqlBjx0+z/ExU6VNo5OHSXS/5nc6BfkEQJvSdVbWp0=
98+
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827042333-110c433a2469/go.mod h1:Mk8AhvlqFbjI9oW2ymThSSoqc6kiEH0/tCmHGMEu6ac=
9799
github.com/ethereum-optimism/optimism v1.9.3 h1:SZs2fCkp1mWMLeD82azt8UYYQc0CkWQFtetuop9KTX8=
98100
github.com/ethereum-optimism/optimism v1.9.3/go.mod h1:hBy5DjWde0XP/berSXl16EMsKS2D2WDQ7us/yzd4PG0=
99101
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac h1:hCIrLuOPV3FJfMDvXeOhCC3uQNvFoMIIlkT2mN2cfeg=
100102
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac/go.mod h1:XaVXL9jg8BcyOeugECgIUGa9Y3DjYJj71RHmb5qon6M=
101103
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
102104
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
103-
github.com/ethereum/go-ethereum v1.14.8 h1:NgOWvXS+lauK+zFukEvi85UmmsS/OkV0N23UZ1VTIig=
104-
github.com/ethereum/go-ethereum v1.14.8/go.mod h1:TJhyuDq0JDppAkFXgqjwpdlQApywnu/m10kFPxh8vvs=
105105
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
106106
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w=
107107
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -265,9 +265,8 @@ github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOEL
265265
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
266266
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
267267
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
268+
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
268269
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
269-
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
270-
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
271270
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
272271
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
273272
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

metabased-publisher/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ endif
2626

2727
metabased-publisher:
2828
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CGO_ENABLED=0 go build -v $(LDFLAGS) -o ./bin/metabased-publisher ./cmd
29+
.PHONY: metabased-publisher
30+
31+
test:
32+
go test -v ./...
33+
.PHONY: test

metabased-publisher/go.mod

Lines changed: 0 additions & 116 deletions
This file was deleted.

op-translator/Makefile

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
test:
2-
go test -v ./...
3-
.PHONY: test
1+
GITCOMMIT ?= $(shell git rev-parse HEAD)
2+
GITDATE ?= $(shell git show -s --format='%ct')
3+
# Find the github tag that points to this commit. If none are found, set the version string to "untagged"
4+
# Prioritizes release tag, if one exists, over tags suffixed with "-rc"
5+
VERSION ?= $(shell tags=$$(git tag --points-at $(GITCOMMIT) | grep '^op-translator/' | sed 's/op-translator\///' | sort -V); \
6+
preferred_tag=$$(echo "$$tags" | grep -v -- '-rc' | tail -n 1); \
7+
if [ -z "$$preferred_tag" ]; then \
8+
if [ -z "$$tags" ]; then \
9+
echo "untagged"; \
10+
else \
11+
echo "$$tags" | tail -n 1; \
12+
fi \
13+
else \
14+
echo $$preferred_tag; \
15+
fi)
416

5-
lint:
6-
golangci-lint run --timeout=10m --config=.golangci.yaml --allow-parallel-runners
7-
.PHONY: lint
17+
LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
18+
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
19+
LDFLAGSSTRING +=-X main.Version=$(VERSION)
20+
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"
821

9-
lint-fix:
10-
golangci-lint run --timeout=10m --config=.golangci.yaml --allow-parallel-runners --fix
11-
.PHONY: lint-fix
22+
# Use the old Apple linker to workaround broken xcode - https://github.com/golang/go/issues/65169
23+
ifeq ($(shell uname),Darwin)
24+
FUZZLDFLAGS := -ldflags=-extldflags=-Wl,-ld_classic
25+
endif
1226

13-
format:
14-
go fmt ./...
15-
.PHONY: format
27+
op-translator:
28+
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CGO_ENABLED=0 go build -v $(LDFLAGS) -o ./bin/op-translator .
29+
.PHONY: op-translator
1630

17-
build:
18-
go build ./...
19-
.PHONY: build
31+
test:
32+
go test -v ./...
33+
.PHONY: test
2034

21-
metabased-publisher:
22-
make -C ./metabased-publisher metabased-publisher
23-
.PHONY: metabased-publisher

0 commit comments

Comments
 (0)