Skip to content

Commit

Permalink
Move all go packages into a single module (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergekh2 authored May 21, 2024
1 parent cb69c7d commit 02474ff
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 744 deletions.
27 changes: 13 additions & 14 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ ARG VER_VERSION=version_unset
ARG VER_BRANCH=branch_unset
ARG VER_COMMIT=commit_unset

# Build node_app
# Prepare build environment
WORKDIR /build
COPY node node
COPY xchain xchain
COPY go.* .
RUN go mod download

# Build stream_node
WORKDIR /build/node
COPY node/go.* /build/node/node/
COPY xchain/ /build/node/xchain/
RUN cd node && go mod download
COPY node/ /build/node/node
RUN cd node && go build \
RUN go build \
-trimpath \
-o /bin/stream_node \
-ldflags="-X github.com/river-build/river/core/node/node/version.version=$VER_VERSION -X github.com/river-build/river/core/node/node/version.branch=$VER_BRANCH -X github.com/river-build/river/core/node/node/version.commit=$VER_COMMIT" \
./node

# Build xchain_app
# Build xchain_node
WORKDIR /build/xchain
COPY xchain/go.* /build/xchain/xchain/
COPY node/ /build/xchain/node/
RUN cd xchain && go mod download
COPY xchain/ /build/xchain/xchain/
RUN cd xchain && go build -trimpath -o /bin/xchain_node ./node
RUN go build -trimpath -o /bin/xchain_node ./node

# Final stage
FROM alpine:latest
Expand All @@ -47,8 +46,8 @@ COPY --from=builder /bin/xchain_node /usr/bin/xchain_node
# Use setcap to allow the web server binary to bind to privileged ports
RUN setcap 'cap_net_bind_service=+ep' /usr/bin/stream_node

COPY --from=builder /build/node/node/default_config.yaml /riveruser/stream_node/config/config.yaml
COPY --from=builder /build/xchain/xchain/default_config.yaml /riveruser/xchain_node/config/config.yaml
COPY --from=builder /build/node/default_config.yaml /riveruser/stream_node/config/config.yaml
COPY --from=builder /build/xchain/default_config.yaml /riveruser/xchain_node/config/config.yaml

RUN mkdir -p /riveruser/stream_node/logs
RUN mkdir -p /riveruser/xchain_node/logs
Expand Down
5 changes: 1 addition & 4 deletions core/node/go.mod → core/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/river-build/river/core/node
module github.com/river-build/river/core

go 1.22.2

replace github.com/river-build/river/core/xchain => ./../xchain

require (
connectrpc.com/connect v1.14.0
github.com/deckarep/golang-set/v2 v2.3.1
Expand All @@ -17,7 +15,6 @@ require (
github.com/matoous/go-nanoid v1.5.0
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.16.0
github.com/river-build/river/core/xchain v0.0.0-00010101000000-000000000000
github.com/rogpeppe/go-internal v1.11.0
github.com/rs/cors v1.9.0
github.com/spf13/cobra v1.8.0
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion core/xchain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test:
go test -v ./...

integration_tests:
go test -timeout 10m core/xchain/server -v -tags integration
go test -timeout 10m ./server -v -tags integration

# The `vet` target runs go vet to examine Go source code and reports suspicious constructs.
vet:
Expand Down
13 changes: 7 additions & 6 deletions core/xchain/client_simulator/client_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ package client_simulator

import (
"context"
"core/xchain/config"
"core/xchain/contracts"
"core/xchain/entitlement"
"core/xchain/examples"
"crypto/ecdsa"
"fmt"
"math/big"
"time"

"github.com/river-build/river/core/xchain/config"
"github.com/river-build/river/core/xchain/contracts"
"github.com/river-build/river/core/xchain/entitlement"
"github.com/river-build/river/core/xchain/examples"

node_contracts "github.com/river-build/river/core/node/contracts"
node_crypto "github.com/river-build/river/core/node/crypto"
"github.com/river-build/river/core/node/dlog"

xc "core/xchain/common"
xc "github.com/river-build/river/core/xchain/common"

e "core/xchain/contracts"
e "github.com/river-build/river/core/xchain/contracts"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down
5 changes: 3 additions & 2 deletions core/xchain/cmd/register_node_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package cmd
import (
"bufio"
"context"
"core/xchain/contracts"
"core/xchain/util"
"fmt"
"os"
"time"

"github.com/river-build/river/core/xchain/contracts"
"github.com/river-build/river/core/xchain/util"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
node_contracts "github.com/river-build/river/core/node/contracts"
Expand Down
3 changes: 2 additions & 1 deletion core/xchain/cmd/root_cmd.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package cmd

import (
"core/xchain/config"
"fmt"
"os"
"strings"

"github.com/river-build/river/core/xchain/config"

sconfig "github.com/river-build/river/core/node/config"
"github.com/river-build/river/core/node/infra"
"github.com/spf13/cobra"
Expand Down
3 changes: 2 additions & 1 deletion core/xchain/cmd/run_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package cmd

import (
"context"
"core/xchain/server"
"os"
"os/signal"
"sync"
"syscall"

"github.com/river-build/river/core/xchain/server"

"github.com/spf13/cobra"
)

Expand Down
5 changes: 3 additions & 2 deletions core/xchain/cmd/run_cs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package cmd
import (
"bufio"
"context"
xc "core/xchain/client_simulator"
"core/xchain/util"
"log"
"os"
"os/signal"
"syscall"

xc "github.com/river-build/river/core/xchain/client_simulator"
"github.com/river-build/river/core/xchain/util"

"github.com/river-build/river/core/node/dlog"
"github.com/spf13/cobra"
)
Expand Down
7 changes: 4 additions & 3 deletions core/xchain/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package contracts

import (
"context"
"core/xchain/config"
dev "core/xchain/contracts/dev"
v3 "core/xchain/contracts/v3"
"math/big"

"github.com/river-build/river/core/xchain/config"
dev "github.com/river-build/river/core/xchain/contracts/dev"
v3 "github.com/river-build/river/core/xchain/contracts/v3"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down
9 changes: 5 additions & 4 deletions core/xchain/entitlement/check_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package entitlement

import (
"context"
"core/xchain/bindings/erc20"
"core/xchain/bindings/erc721"
"core/xchain/config"
"core/xchain/contracts"
"fmt"
"math/big"
"sync"
"time"

"github.com/river-build/river/core/xchain/bindings/erc20"
"github.com/river-build/river/core/xchain/bindings/erc721"
"github.com/river-build/river/core/xchain/config"
"github.com/river-build/river/core/xchain/contracts"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/river-build/river/core/node/dlog"
Expand Down
3 changes: 2 additions & 1 deletion core/xchain/entitlement/client_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package entitlement

import (
"context"
"core/xchain/config"

"github.com/river-build/river/core/xchain/config"

"github.com/ethereum/go-ethereum/ethclient"
. "github.com/river-build/river/core/node/base"
Expand Down
5 changes: 3 additions & 2 deletions core/xchain/entitlement/entitlement.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package entitlement

import (
"context"
"core/xchain/config"
"errors"
"fmt"
"math/big"
"sync"

er "core/xchain/contracts"
"github.com/river-build/river/core/xchain/config"

er "github.com/river-build/river/core/xchain/contracts"

"github.com/ethereum/go-ethereum/common"
"github.com/river-build/river/core/node/dlog"
Expand Down
5 changes: 3 additions & 2 deletions core/xchain/entitlement/entitlement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package entitlement

import (
"context"
"core/xchain/config"
"core/xchain/examples"
"math/big"
"testing"
"time"

"github.com/river-build/river/core/xchain/config"
"github.com/river-build/river/core/xchain/examples"

"github.com/stretchr/testify/require"

"github.com/ethereum/go-ethereum/common"
Expand Down
116 changes: 0 additions & 116 deletions core/xchain/go.mod

This file was deleted.

Loading

0 comments on commit 02474ff

Please sign in to comment.