Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Go 1.24 and new tools #490

Merged
merged 7 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 0 additions & 1 deletion .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m --config .golangci.yaml
- run: go install github.com/segmentio/golines
- name: golines
uses: nickcharlton/diff-check@main
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: bufbuild/[email protected]
- name: Generate Protos
run: dev/gen-protos
- name: Create Pull Request
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ To keep up with and provide feedback about `xmtpd` development, see the [Issues

## Prerequisites

- [Go 1.22](https://go.dev/doc/install) -- On macOS install with `brew install go@1.22`
- [Go 1.24](https://go.dev/doc/install) -- On macOS install with `brew install go@1.24`
- [Docker](https://www.docker.com/get-started/)
- [Foundry](https://github.com/foundry-rs/foundry)

Note that a dependency of this repo will not compile with version of go newer than 1.22.

## Install and build dependencies

To install dependencies and build background services needed by the node, run:
Expand Down
2 changes: 1 addition & 1 deletion dev/baked/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BUILD IMAGE --------------------------------------------------------
ARG GO_VERSION=1.23
ARG GO_VERSION=1.24
ARG FOUNDRY_VERSION=0.3.0
FROM golang:${GO_VERSION}-bookworm AS builder

Expand Down
2 changes: 1 addition & 1 deletion dev/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BUILD IMAGE --------------------------------------------------------
ARG GO_VERSION=1.23
ARG GO_VERSION=1.24
FROM golang:${GO_VERSION}-alpine AS builder

# Get build tools and required header files
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/Dockerfile-cli
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BUILD IMAGE --------------------------------------------------------
ARG GO_VERSION=1.23
ARG GO_VERSION=1.24
FROM golang:${GO_VERSION}-alpine AS builder

# Get build tools and required header files
Expand Down
2 changes: 1 addition & 1 deletion dev/gen-migration
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -e

migrate create -dir pkg/migrations -seq -digits=5 -ext sql $1
go tool -modfile=tools/go.mod migrate create -dir pkg/migrations -seq -digits=5 -ext sql $1
2 changes: 1 addition & 1 deletion dev/gen-protos
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

rm -rf pkg/proto/**/*.pb.go pkg/proto/**/*.pb.gw.go pkg/proto/**/*.swagger.json
if ! buf generate https://github.com/xmtp/proto.git#subdir=proto,branch=main; then
if ! go tool -modfile=tools/go.mod buf generate https://github.com/xmtp/proto.git#subdir=proto,branch=main; then
echo "Failed to generate protobuf definitions"
exit 1
fi
4 changes: 2 additions & 2 deletions dev/generate
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -euo pipefail

./dev/gen-protos
sqlc generate
go tool -modfile=tools/go.mod sqlc generate
go generate ./...
rm -rf pkg/mocks/*
./contracts/dev/generate
mockery
go tool -modfile=tools/go.mod mockery
2 changes: 1 addition & 1 deletion dev/lint-golines
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -e

golines -w --ignored-dirs=proto --ignored-dirs=mocks --ignored-dirs=abis --ignored-dirs=queries .
go tool -modfile=tools/go.mod golines -w --ignored-dirs=proto --ignored-dirs=mocks --ignored-dirs=abis --ignored-dirs=queries .
17 changes: 0 additions & 17 deletions dev/up
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,9 @@
set -e

if ! which forge &>/dev/null; then echo "ERROR: Missing foundry binaries. Run 'curl -L https://foundry.paradigm.xyz | bash' and follow the instructions" && exit 1; fi
if ! which migrate &>/dev/null; then go install github.com/golang-migrate/migrate/v4/cmd/migrate; fi
if ! which golangci-lint &>/dev/null; then brew install golangci-lint; fi
if ! which shellcheck &>/dev/null; then brew install shellcheck; fi
if ! which mockery &>/dev/null; then go install github.com/vektra/mockery/v2; fi
if ! which sqlc &> /dev/null; then go install github.com/sqlc-dev/sqlc/cmd/sqlc; fi
if ! which buf &> /dev/null; then go install github.com/bufbuild/buf/cmd/buf; fi
if ! which golines &>/dev/null; then go install github.com/segmentio/golines@latest; fi
if ! which jq &>/dev/null; then brew install jq; fi

# Pin abigen version at can introduce breaking changes between releases, rendering different ABIs.
if ! which abigen &>/dev/null; then
go install github.com/ethereum/go-ethereum/cmd/[email protected]
fi

abigen_version=$(abigen --version | awk '{print $3}')
if [[ ${abigen_version} != "1.14.12-stable" ]]; then
echo "ERROR: abigen version is not 1.14.12. Please install the correct version."
exit 1
fi

echo -e "→ Generate smart contracts bindings"
contracts/dev/generate

Expand Down
10 changes: 0 additions & 10 deletions dev/update-tools

This file was deleted.

Loading
Loading