Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ runs:
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: 1.21.3
go-version: 1.20.10
- name: Install asdf & tools
uses: asdf-vm/actions/setup@v2
- name: Setup
shell: bash
run: |
asdf plugin-add protoc https://github.com/paxosglobal/asdf-protoc.git
asdf install protoc 24.4
asdf global protoc 24.4
make bootstrap
run: make bootstrap
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
protoc 24.4
yq 4.35.2
grpcurl 1.8.8
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as build
FROM golang:1.20 as build

ENV GO111MODULE on

Expand All @@ -11,7 +11,7 @@ RUN go mod download
COPY . ./
RUN make bin

FROM golang:1.18 as deploy
FROM golang:1.20 as deploy

WORKDIR /app/

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,16 @@ It aims to provide an efficient and flexible way to access the on-chain data:

## Quick Start

Make sure your local go version is 1.18 by running the following commands:
If you're not using [asdf](https://asdf-vm.com/), then make sure your local go version is 1.20+ by running the following commands:

```shell
brew install go@1.18
brew install go@1.20.10
brew unlink go
brew link go@1.18
brew link go@1.20.10

brew install protobuf@3.21.12
brew unlink protobuf
brew link protobuf

```

To set up for the first time (only done once):
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/coinbase/chainstorage

go 1.18
go 1.20

require (
github.com/VividCortex/ewma v1.2.0
Expand Down
30 changes: 27 additions & 3 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,40 @@

set -exo pipefail

source ./scripts/precheck.sh

# Use asdf if it's available
if [ -x "$(command -v asdf)" ]; then
if ! [ -x "$(command -v go)" ]; then
if ! asdf plugin-list | grep -e '^golang$' &> /dev/null; then
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
asdf install golang 1.20.10
asdf global golang 1.20.10
fi
fi
if ! asdf plugin-list | grep -e '^yq$' &> /dev/null; then
asdf plugin-add yq https://github.com/sudermanjr/asdf-yq.git
fi
if ! asdf plugin-list | grep -e '^protoc$' &> /dev/null; then
asdf plugin-add protoc https://github.com/paxosglobal/asdf-protoc.git
fi
if ! asdf plugin-list | grep -e '^grpcurl$' &> /dev/null; then
asdf plugin-add grpcurl https://github.com/asdf-community/asdf-grpcurl.git
fi
asdf install
else
source ./scripts/precheck.sh
go install github.com/mikefarah/yq/v4@v4.35.2
fi

go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
go install github.com/mikefarah/yq/v4@v4.35.2
go install github.com/golang/mock/mockgen@v1.6.0
go install github.com/gordonklaus/ineffassign@v0.0.0-20230610083614-0e73809eb601
go install github.com/kisielk/errcheck@v1.6.3
go install github.com/go-bindata/go-bindata/go-bindata@v3.1.2
go install golang.org/x/tools/cmd/goimports@v0.13.0
go mod download
go mod tidy

if [ -x "$(command -v asdf)" ]; then
asdf reshim
fi
6 changes: 6 additions & 0 deletions scripts/precheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -eo pipefail

# Check if golang is installed
if ! [ -x "$(command -v go)" ]; then
echo 'Error: go is not installed. Please refer https://golang.org/ for installation instruction' >&2
exit 1
fi

# Check if protobuf is installed
if ! [ -x "$(command -v protoc)" ]; then
echo 'Error: protobuf is not installed. Please refer https://grpc.io/docs/protoc-installation/ for installation instruction' >&2
Expand Down