From d306be2421e09687c3fd50f6751a76e806ef8784 Mon Sep 17 00:00:00 2001 From: Stanislav Viyachev Date: Thu, 9 Nov 2023 18:13:44 +0200 Subject: [PATCH] Update go workflow files versions Signed-off-by: Stanislav Viyachev --- .github/workflows/go-build.yaml | 8 ++++---- .github/workflows/go-test.yaml | 6 +++--- .github/workflows/mainnet-deploy-to-vms.yaml | 2 +- .github/workflows/mainnet-release-gcr-publish.yaml | 2 +- .github/workflows/outdated-dependencies.yaml | 6 +++--- .github/workflows/run-e2e.yaml | 6 +++--- .github/workflows/staticcheck.yaml | 6 +++--- .github/workflows/testnet-deploy-to-vms.yaml | 8 ++++---- .github/workflows/testnet-release-gcr-publish.yaml | 2 +- app/clients/hedera/mirror-node/client.go | 4 ++-- app/helper/http/encode.go | 3 +-- app/router/transfer-reset/transfer-reset_test.go | 6 +++--- config/config.go | 3 +-- config/loggcp.go | 2 +- e2e/clients/validator.go | 4 ++-- .../setup/extend-config/cmd/extend-bridge-config.go | 9 +++++---- .../bridge/update-config/cmd/prepare-update-config.go | 9 +++++---- 17 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/go-build.yaml b/.github/workflows/go-build.yaml index 6770c4cc2..e500ea0af 100644 --- a/.github/workflows/go-build.yaml +++ b/.github/workflows/go-build.yaml @@ -6,11 +6,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 name: Setup GO Env with: - go-version: '1.18' + go-version: '1.20' - name: Cache Go modules uses: actions/cache@v2 with: @@ -19,7 +19,7 @@ jobs: restore-keys: | ${{ runner.os }}-go- - name: Build hedera-eth-bridge-validator - run: go build -i -o validator cmd/* + run: go build -o validator cmd/* - name: Upload Binary as artifact uses: actions/upload-artifact@master with: diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml index 465fd8ddd..7939a1577 100644 --- a/.github/workflows/go-test.yaml +++ b/.github/workflows/go-test.yaml @@ -6,11 +6,11 @@ jobs: unit-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 name: Setup GO Env with: - go-version: '1.18' + go-version: '1.20' - name: Cache Go Test modules uses: actions/cache@v2 with: diff --git a/.github/workflows/mainnet-deploy-to-vms.yaml b/.github/workflows/mainnet-deploy-to-vms.yaml index 110121fef..5656adb7c 100644 --- a/.github/workflows/mainnet-deploy-to-vms.yaml +++ b/.github/workflows/mainnet-deploy-to-vms.yaml @@ -13,7 +13,7 @@ jobs: deploy_mainnet_dave: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 diff --git a/.github/workflows/mainnet-release-gcr-publish.yaml b/.github/workflows/mainnet-release-gcr-publish.yaml index 1e7a9847b..614c772cc 100644 --- a/.github/workflows/mainnet-release-gcr-publish.yaml +++ b/.github/workflows/mainnet-release-gcr-publish.yaml @@ -10,7 +10,7 @@ jobs: if: | ! contains(github.event.release.tag_name, '-rc-') steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 diff --git a/.github/workflows/outdated-dependencies.yaml b/.github/workflows/outdated-dependencies.yaml index 803968a85..053eed755 100644 --- a/.github/workflows/outdated-dependencies.yaml +++ b/.github/workflows/outdated-dependencies.yaml @@ -8,10 +8,10 @@ jobs: go-mod-outdated: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 name: Setup GO Env with: - go-version: '1.18' + go-version: '1.20' - name: Run go-mod-outdated run: go list -u -m -json all | docker run --rm -i psampaz/go-mod-outdated -update -direct -ci diff --git a/.github/workflows/run-e2e.yaml b/.github/workflows/run-e2e.yaml index f35c7cbeb..f5aa9fe3b 100644 --- a/.github/workflows/run-e2e.yaml +++ b/.github/workflows/run-e2e.yaml @@ -11,11 +11,11 @@ jobs: e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 name: Setup GO Env with: - go-version: '1.18' + go-version: '1.20' - name: Cache Go E2E Test modules uses: actions/cache@v2 with: diff --git a/.github/workflows/staticcheck.yaml b/.github/workflows/staticcheck.yaml index 58d84af35..32cb39779 100644 --- a/.github/workflows/staticcheck.yaml +++ b/.github/workflows/staticcheck.yaml @@ -9,11 +9,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: WillAbides/setup-go-faster@v1.8.0 + - uses: WillAbides/setup-go-faster@v1.9.1 with: - go-version: "1.18.x" + go-version: "1.20" - uses: dominikh/staticcheck-action@v1.3.0 with: checks: "all,-ST*,-S1002,-S1005,-S1008,-S1023,-S1039,-U1000" version: "2022.1.3" - install-go: false \ No newline at end of file + install-go: true \ No newline at end of file diff --git a/.github/workflows/testnet-deploy-to-vms.yaml b/.github/workflows/testnet-deploy-to-vms.yaml index ca284e025..5460a8320 100644 --- a/.github/workflows/testnet-deploy-to-vms.yaml +++ b/.github/workflows/testnet-deploy-to-vms.yaml @@ -13,7 +13,7 @@ jobs: deploy_testnet_alice: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 @@ -47,7 +47,7 @@ jobs: deploy_testnet_bob: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 @@ -81,7 +81,7 @@ jobs: deploy_testnet_carol: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 @@ -115,7 +115,7 @@ jobs: deploy_testnet_dave: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 diff --git a/.github/workflows/testnet-release-gcr-publish.yaml b/.github/workflows/testnet-release-gcr-publish.yaml index 43145eedb..2a30d68d5 100644 --- a/.github/workflows/testnet-release-gcr-publish.yaml +++ b/.github/workflows/testnet-release-gcr-publish.yaml @@ -10,7 +10,7 @@ jobs: if: | contains(github.event.release.tag_name, '-rc-') steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup GCloud SDK uses: google-github-actions/setup-gcloud@v0.2.0 diff --git a/app/clients/hedera/mirror-node/client.go b/app/clients/hedera/mirror-node/client.go index 29e34d6be..b9281ecc1 100644 --- a/app/clients/hedera/mirror-node/client.go +++ b/app/clients/hedera/mirror-node/client.go @@ -19,7 +19,7 @@ package mirror_node import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -622,5 +622,5 @@ func (c Client) getTopicMessagesByQuery(query string) ([]message.Message, error) func readResponseBody(response *http.Response) ([]byte, error) { defer response.Body.Close() - return ioutil.ReadAll(response.Body) + return io.ReadAll(response.Body) } diff --git a/app/helper/http/encode.go b/app/helper/http/encode.go index d4623244c..142560710 100644 --- a/app/helper/http/encode.go +++ b/app/helper/http/encode.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/json" "io" - "io/ioutil" ) func EncodeBodyContent(content interface{}) (io.ReadCloser, error) { @@ -30,7 +29,7 @@ func EncodeBodyContent(content interface{}) (io.ReadCloser, error) { return nil, encodeErr } encodedResponseReader := bytes.NewReader(encodedResponseBuffer.Bytes()) - encodedResponseReaderCloser := ioutil.NopCloser(encodedResponseReader) + encodedResponseReaderCloser := io.NopCloser(encodedResponseReader) return encodedResponseReaderCloser, nil } diff --git a/app/router/transfer-reset/transfer-reset_test.go b/app/router/transfer-reset/transfer-reset_test.go index 162e53c31..dcc77a0c1 100644 --- a/app/router/transfer-reset/transfer-reset_test.go +++ b/app/router/transfer-reset/transfer-reset_test.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "errors" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -51,7 +51,7 @@ func Test_GetTransferSuccess(t *testing.T) { handler(w, req) res := w.Result() defer res.Body.Close() - data, _ := ioutil.ReadAll(res.Body) + data, _ := io.ReadAll(res.Body) assert.Equal(t, http.StatusOK, res.StatusCode) assert.Equal(t, "OK", string(data)) @@ -146,7 +146,7 @@ func Test_GetTransferSuccess_FailsWithEmptyPassword(t *testing.T) { "SourceChainId": 1, "TargetChainId": 2, "SourceToken": "token", - "Password": "", + "Password": "", } reqBody, _ := json.Marshal(body) diff --git a/config/config.go b/config/config.go index cc189063d..e24fd6871 100644 --- a/config/config.go +++ b/config/config.go @@ -17,7 +17,6 @@ package config import ( - "io/ioutil" "os" "path/filepath" @@ -64,7 +63,7 @@ func GetConfig(config interface{}, path string) error { log.Fatal(err) } - yamlFile, err := ioutil.ReadFile(filename) + yamlFile, err := os.ReadFile(filename) if err != nil { log.Fatal(err) } diff --git a/config/loggcp.go b/config/loggcp.go index df14a3309..24dbbbb8b 100644 --- a/config/loggcp.go +++ b/config/loggcp.go @@ -142,4 +142,4 @@ func (f *GCEFormatter) Format(entry *logrus.Entry) ([]byte, error) { return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) } return append(serialized, '\n'), nil -} \ No newline at end of file +} diff --git a/e2e/clients/validator.go b/e2e/clients/validator.go index 97ebc147a..ad5e0811e 100644 --- a/e2e/clients/validator.go +++ b/e2e/clients/validator.go @@ -19,7 +19,7 @@ package clients import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "time" ) @@ -68,5 +68,5 @@ func (v *Validator) get(url string) ([]byte, error) { return nil, fmt.Errorf("GET resolved with status [%d].", response.StatusCode) } - return ioutil.ReadAll(response.Body) + return io.ReadAll(response.Body) } diff --git a/scripts/bridge/setup/extend-config/cmd/extend-bridge-config.go b/scripts/bridge/setup/extend-config/cmd/extend-bridge-config.go index e0c415920..3d75d45fb 100644 --- a/scripts/bridge/setup/extend-config/cmd/extend-bridge-config.go +++ b/scripts/bridge/setup/extend-config/cmd/extend-bridge-config.go @@ -19,6 +19,10 @@ package main import ( "flag" "fmt" + "math" + "os" + "strconv" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/limechain/hedera-eth-bridge-validator/app/clients/evm" @@ -30,9 +34,6 @@ import ( "github.com/limechain/hedera-eth-bridge-validator/scripts/bridge/setup/parser" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" - "io/ioutil" - "math" - "strconv" ) const ( @@ -101,7 +102,7 @@ func createOutputFile(extendedBridgeCfg *parser.ExtendedBridge) { if err != nil { panic(fmt.Sprintf("Failed to marshal extended bridge config to yaml. Err: [%s]", err)) } - err = ioutil.WriteFile(outputFilePath, extendedBridgeYml, 0644) + err = os.WriteFile(outputFilePath, extendedBridgeYml, 0644) if err != nil { panic(fmt.Sprintf("failed to write new-bridge.yml file. Err: [%s]", err)) } diff --git a/scripts/bridge/update-config/cmd/prepare-update-config.go b/scripts/bridge/update-config/cmd/prepare-update-config.go index 8f91becda..c96ec08fb 100644 --- a/scripts/bridge/update-config/cmd/prepare-update-config.go +++ b/scripts/bridge/update-config/cmd/prepare-update-config.go @@ -20,11 +20,12 @@ import ( "encoding/hex" "flag" "fmt" + "os" + "time" + "github.com/hashgraph/hedera-sdk-go/v2" - "github.com/limechain/hedera-eth-bridge-validator/scripts/bridge/update-config" + update_config "github.com/limechain/hedera-eth-bridge-validator/scripts/bridge/update-config" clientScript "github.com/limechain/hedera-eth-bridge-validator/scripts/client" - "io/ioutil" - "time" ) func main() { @@ -51,7 +52,7 @@ func main() { } func parseParams(configPath *string, topicId *string, executorId *string, nodeAccountId *string) ([]byte, hedera.TopicID, hedera.AccountID, hedera.AccountID) { - content, err := ioutil.ReadFile(*configPath) + content, err := os.ReadFile(*configPath) if err != nil { panic(err) }