Skip to content

Commit

Permalink
Merge pull request #381 from meshplus/fix(1.23)/grpc_version
Browse files Browse the repository at this point in the history
fix: grpc and packr version
  • Loading branch information
levi9311 authored Jan 3, 2023
2 parents 6eeb32d + b6cd2c4 commit adc471d
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN go mod download -x
# Build real binaries
COPY . .

RUN go get -u github.com/gobuffalo/packr/packr
RUN go get github.com/gobuffalo/packr/v2/packr2@v2.8.3

RUN make install

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@ test-coverage:
@go test -short -coverprofile cover.out -covermode=atomic ${TEST_PKGS}
@cat cover.out >> coverage.txt

packr:
cd internal/repo && packr
packr2:
cd internal/repo && packr2

prepare:
cd scripts && bash prepare.sh

## make install: Go install the project (hpc)
install: packr
install: packr2
rm -f imports/imports.go
$(GO) install $(GOFLAG) -ldflags '${GOLDFLAGS}' ./cmd/${APP_NAME}
@printf "${GREEN}Install pier successfully${NC}\n"

build: packr
build: packr2
@mkdir -p bin
rm -f imports/imports.go
$(GO) build $(GOFLAG) -ldflags '${GOLDFLAGS}' ./cmd/${APP_NAME}
@mv ./pier bin
@printf "${GREEN}Build Pier successfully!${NC}\n"

installent: packr
installent: packr2
cp imports/imports.go.template imports/imports.go
@sed "s?)?$(MODS))?" go.mod | tr '@' '\n' > goent.mod
@cat goent.diff | grep '^replace' >> goent.mod
$(GO) install $(GOFLAG) -tags ent -ldflags '${GOLDFLAGS}' -modfile goent.mod ./cmd/${APP_NAME}
@printf "${GREEN}Install pier ent successfully${NC}\n"

buildent: packr
buildent: packr2
@mkdir -p bin
cp imports/imports.go.template imports/imports.go
@sed "s?)?$(MODS)@)?" go.mod | tr '@' '\n' > goent.mod
Expand All @@ -86,7 +86,7 @@ buildent: packr
mod:
sed "s?)?$(MODS)\n)?" go.mod

docker-build: packr
docker-build: packr2
$(GO) install $(GOFLAG) -ldflags '${STATIC_LDFLAGS}' ./cmd/${APP_NAME}
@echo "Build pier successfully"

Expand Down
4 changes: 2 additions & 2 deletions cmd/pier/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/cavaliercoder/grab"
"github.com/gobuffalo/packd"
"github.com/gobuffalo/packr"
packr2 "github.com/gobuffalo/packr/v2"
"github.com/meshplus/bitxhub-kit/fileutil"
"github.com/meshplus/bitxhub-kit/types"
"github.com/meshplus/pier/internal/repo"
Expand Down Expand Up @@ -416,7 +416,7 @@ func updateAppchainType(repoRoot, chainType string) error {
}

func copyDir(srcDir, dstDir string) error {
box := packr.NewBox(srcDir)
box := packr2.New("box", srcDir)
return box.Walk(func(s string, file packd.File) error {
p := filepath.Join(dstDir, s)
dir := filepath.Dir(p)
Expand Down
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ go 1.13
require (
github.com/Rican7/retry v0.1.0
github.com/btcsuite/btcd v0.21.0-beta
github.com/bytecodealliance/wasmtime-go v0.37.0 // indirect
github.com/cavaliercoder/grab v2.0.0+incompatible
github.com/cbergoon/merkletree v0.2.0
github.com/fatih/color v1.9.0
github.com/fsnotify/fsnotify v1.4.9
github.com/gobuffalo/packd v1.0.0
github.com/gobuffalo/packr v1.30.1
github.com/gobuffalo/packd v1.0.1
github.com/gobuffalo/packr/v2 v2.8.3
github.com/golang/mock v1.6.0
github.com/google/btree v1.0.0
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
Expand All @@ -24,15 +25,15 @@ require (
github.com/meshplus/go-lightp2p v0.0.0-20200817105923-6b3aee40fa54
github.com/mitchellh/go-homedir v1.1.0
github.com/multiformats/go-multiaddr v0.3.0
github.com/pelletier/go-toml v1.8.1
github.com/pelletier/go-toml v1.9.3
github.com/sirupsen/logrus v1.8.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.8.0
github.com/tidwall/gjson v1.6.8
github.com/urfave/cli v1.22.1
github.com/wonderivan/logger v1.0.0
go.uber.org/atomic v1.7.0
google.golang.org/grpc v1.33.2
google.golang.org/grpc v1.38.0
)

replace github.com/libp2p/go-libp2p-core => github.com/libp2p/go-libp2p-core v0.5.6
Expand Down
214 changes: 212 additions & 2 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/fsnotify/fsnotify"
"github.com/gobuffalo/packd"
"github.com/gobuffalo/packr"
packr2 "github.com/gobuffalo/packr/v2"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/mitchellh/go-homedir"
Expand Down Expand Up @@ -70,7 +70,7 @@ func Initialize(repoRoot, algo string) error {
}
}

box := packr.NewBox(ConfigPath)
box := packr2.New("box", ConfigPath)

cryptoType, err := crypto.CryptoNameToType(algo)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion scripts/cross_compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ linux-amd64)
pier-ubuntu/compile \
/bin/bash -c "go env -w GO111MODULE=on &&
go env -w GOPROXY=https://goproxy.cn,direct &&
go get -u github.com/gobuffalo/packr/packr &&
go install github.com/gobuffalo/packr/v2/packr2@v2.8.3 &&
cd /code/pier-client-fabric && make fabric1.4 &&
cd /code/pier-client-ethereum && make eth &&
cd /code/pier && make install &&
Expand Down
13 changes: 11 additions & 2 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
BLUE='\033[0;34m'
NC='\033[0m'

function go_install() {
version=$(go env GOVERSION)
if [[ ! "$version" < "go1.16" ]];then
go install "$@"
else
go get "$@"
fi
}

function print_blue() {
printf "${BLUE}%s${NC}\n" "$1"
}

print_blue "===> 1. Install packr"
if ! type packr >/dev/null 2>&1; then
go get -u github.com/gobuffalo/packr/packr@v1.30.1
if ! type packr2 >/dev/null 2>&1; then
go_install github.com/gobuffalo/packr/v2/packr2@v2.8.3
fi

print_blue "===> 2. Install golangci-lint"
Expand Down
14 changes: 11 additions & 3 deletions scripts/release_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ PROJECT_PATH=$(dirname "${CURRENT_PATH}")
RELEASE_PATH=${PROJECT_PATH}/bin
APP_VERSION=$(if [ `git rev-parse --abbrev-ref HEAD` == 'HEAD' ];then git describe --tags HEAD ; else echo "dev" ; fi)

print_blue "===> 1. Install packr"
if ! type packr >/dev/null 2>&1; then
go get -u github.com/gobuffalo/packr/packr@v1.30.1
function go_install() {
version=$(go env GOVERSION)
if [[ ! "$version" < "go1.16" ]];then
go install "$@"
else
go get "$@"
fi
}
print_blue "===> 1. Install packr2"
if ! type packr2 >/dev/null 2>&1; then
go_install github.com/gobuffalo/packr/v2/packr2@v2.8.3
fi

print_blue "===> 2. build pier"
Expand Down

0 comments on commit adc471d

Please sign in to comment.