Skip to content

Commit

Permalink
upgrade go 1.19 (dogechain-lab#318)
Browse files Browse the repository at this point in the history
# Description

go 1.17/1.18 now is EOL, need update go version

# Change

- move columnize library to internal library (columnize library has been
unmaintained for a long time, we need to maintain it)
  • Loading branch information
0xcb9ff9 committed Apr 11, 2023
1 parent 7520391 commit c202b4e
Show file tree
Hide file tree
Showing 10 changed files with 750 additions and 306 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_call:

env:
GO_VERSION: "1.17"
GO_VERSION: "1.19"

jobs:
lint:
Expand All @@ -20,6 +20,11 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
# https://github.com/actions/checkout/issues/1169
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
Expand All @@ -37,6 +42,13 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive

# https://github.com/actions/checkout/issues/1169
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
Expand Down Expand Up @@ -69,6 +81,13 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive

# https://github.com/actions/checkout/issues/1169
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
Expand All @@ -92,6 +111,13 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive

# https://github.com/actions/checkout/issues/1169
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GO_VERSION }}"
Expand Down
52 changes: 28 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
# to be used by fork patch-releases ^^
- "v*.*.*-*"

env:
GO_VERSION: "1.19"

jobs:
goreleaser:
runs-on: ubuntu-latest
Expand All @@ -18,36 +21,37 @@ jobs:
with:
fetch-depth: 0

# https://github.com/actions/checkout/issues/1169
- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Run GoReleaser
run: |
docker run \
--rm \
--privileged \
-e CGO_ENABLED=0 \
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
-e SLACK_WEBHOOK \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:v${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate
- uses: actions/setup-go@v2
with:
go-version: "${{ env.GO_VERSION }}"

- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64,darwin/amd64,darwin/arm64

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist --clean
env:
PACKAGE_NAME: github.com/dogechain-lab/dogechain
GOLANG_CROSS_VERSION: "1.17.9"
CGO_ENABLED: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.prepare.outputs.tag_name }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
if: github.actor == 'abrahamcruise321' || github.actor == 'DarianShawn'
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run:
skip-dirs-use-default: true

service:
golangci-lint-version: 1.49.0
golangci-lint-version: 1.51.2

linters:
# default false
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ builds:
env:
- CC=gcc
- CXX=g++
- GO_ENABLED=0
# We need to build a static binary because we are building in a glibc based system and running in a musl container
ldflags: >
-s -w
Expand All @@ -78,6 +79,7 @@ builds:
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
- GO_ENABLED=0
ldflags: >
-s -w
-X 'github.com/dogechain-lab/dogechain/versioning.Version=v{{ .Version }}'
Expand Down
15 changes: 8 additions & 7 deletions command/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ import (
"net/url"
"time"

"github.com/dogechain-lab/dogechain/chain"
"github.com/dogechain-lab/dogechain/command"
ibftOp "github.com/dogechain-lab/dogechain/consensus/ibft/proto"
"github.com/dogechain-lab/dogechain/server"
"github.com/dogechain-lab/dogechain/server/proto"
txpoolOp "github.com/dogechain-lab/dogechain/txpool/proto"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

ibftOp "github.com/dogechain-lab/dogechain/consensus/ibft/proto"
txpoolOp "github.com/dogechain-lab/dogechain/txpool/proto"

"github.com/dogechain-lab/dogechain/chain"
"github.com/dogechain-lab/dogechain/command"
"github.com/dogechain-lab/dogechain/helper/columnize"
"github.com/dogechain-lab/dogechain/helper/common"
"github.com/ryanuber/columnize"
"github.com/dogechain-lab/dogechain/server"
"github.com/dogechain-lab/dogechain/server/proto"
)

type ClientCloseResult struct {
Expand Down
4 changes: 2 additions & 2 deletions command/txpool/ddoslist/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/dogechain-lab/dogechain/command"
"github.com/dogechain-lab/dogechain/command/helper"
"github.com/dogechain-lab/dogechain/server/proto"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/protobuf/types/known/emptypb"
)

var (
Expand Down Expand Up @@ -38,7 +38,7 @@ func (p *inoutParam) initSystemClient(grpcAddress string) error {
func (p *inoutParam) queryDDOSList() {
rsp, err := p.systemClient.DDOSContractList(
context.Background(),
&empty.Empty{},
&emptypb.Empty{},
)
if err != nil {
p.err = err
Expand Down
Loading

0 comments on commit c202b4e

Please sign in to comment.