Skip to content

Commit

Permalink
Build: Upgrade to Golang 1.23 (#6169)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf authored Nov 18, 2024
1 parent 62f9082 commit 7d4e23b
Show file tree
Hide file tree
Showing 58 changed files with 307 additions and 415 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4.0.1
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
id: go_version
run: echo "GO_VERSION=$(./scripts/get_golang_version.sh)" >> $GITHUB_ENV
- name: Install golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Restore libsodium from cache
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Make libsodium.a
run: sudo mv /usr/bin/go /usr/bin/go.bak && make crypto/libs/linux/amd64/lib/libsodium.a && sudo mv /usr/bin/go.bak /usr/bin/go
- name: reviewdog-golangci-lint
uses: reviewdog/[email protected].1
uses: reviewdog/[email protected].2
with:
go_version_file: go.mod
golangci_lint_version: "v1.58.0"
golangci_lint_version: "v1.62.0"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-check"
tool_name: "Lint Errors"
Expand All @@ -46,7 +46,7 @@ jobs:
id: go_version
run: echo "GO_VERSION=$(./scripts/get_golang_version.sh)" >> $GITHUB_ENV
- name: Install specific golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Create folders for golangci-lint
Expand All @@ -63,13 +63,13 @@ jobs:
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.58.0
git checkout tags/v1.62.0
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.18.1/install.sh | sh -s -- v0.18.1
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2
reviewdog --version
- name: Build custom linters
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: go_version
run: echo "GO_VERSION=$(./scripts/get_golang_version.sh)" >> $GITHUB_ENV
- name: Install go version
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Test tools/block-generator
Expand Down
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
disable-all: true
enable:
- errcheck
- exportloopref
- copyloopvar
- gofmt
- gosimple
- govet
Expand Down Expand Up @@ -127,7 +127,6 @@ issues:
- path: _test\.go
linters:
- errcheck
# - exportloopref
# - gofmt
- gosimple
# - govet
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04 as builder

ARG GO_VERSION="1.21.10"
ARG GO_VERSION="1.23.3"

ARG CHANNEL
ARG URL
Expand Down
1 change: 0 additions & 1 deletion catchup/ledgerFetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func TestLedgerFetcherErrorResponseHandling(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
// create a dummy server.
Expand Down
1 change: 0 additions & 1 deletion cmd/algocfg/getCommand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func TestPrint(t *testing.T) {
},
}
for i, tc := range testcases {
tc := tc
t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) {
t.Parallel()
ret, err := serializeObjectProperty(tc, "Input")
Expand Down
34 changes: 17 additions & 17 deletions cmd/goal/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func panicIfErr(err error) {
func newAppCallBytes(arg string) apps.AppCallBytes {
appBytes, err := apps.NewAppCallBytes(arg)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
return appBytes
}
Expand Down Expand Up @@ -508,7 +508,7 @@ var createAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -569,7 +569,7 @@ var updateAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -579,7 +579,7 @@ var updateAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -639,7 +639,7 @@ var optInAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -649,7 +649,7 @@ var optInAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -709,7 +709,7 @@ var closeOutAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -719,7 +719,7 @@ var closeOutAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -779,7 +779,7 @@ var clearAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -789,7 +789,7 @@ var clearAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -849,7 +849,7 @@ var callAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -859,7 +859,7 @@ var callAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -919,7 +919,7 @@ var deleteAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lv)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand All @@ -929,7 +929,7 @@ var deleteAppCmd = &cobra.Command{
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -1442,7 +1442,7 @@ var methodAppCmd = &cobra.Command{
err = writeSignedTxnsToFile(signedTxnGroup, outFilename)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
return
}
Expand Down Expand Up @@ -1472,12 +1472,12 @@ var methodAppCmd = &cobra.Command{
if !noWaitAfterSend {
_, err := waitForCommit(client, txid, lv)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}

resp, err := client.PendingTransactionInformation(txid)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}

if methodCreatesApp && resp.ApplicationIndex != nil && *resp.ApplicationIndex != 0 {
Expand Down
1 change: 0 additions & 1 deletion cmd/goal/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func TestParseMethodArgJSONtoByteSlice(t *testing.T) {
}

for i, test := range tests {
test := test
t.Run(fmt.Sprintf("index=%d", i), func(t *testing.T) {
t.Parallel()
applicationArgs := [][]byte{}
Expand Down
12 changes: 6 additions & 6 deletions cmd/goal/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ var destroyAssetCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lastValid)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand Down Expand Up @@ -495,7 +495,7 @@ var configAssetCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lastValid)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand Down Expand Up @@ -582,7 +582,7 @@ var sendAssetCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lastValid)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand Down Expand Up @@ -651,7 +651,7 @@ var freezeAssetCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lastValid)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
Expand Down Expand Up @@ -740,13 +740,13 @@ var optinAssetCmd = &cobra.Command{
if !noWaitAfterSend {
_, err2 = waitForCommit(client, txid, lastValid)
if err2 != nil {
reportErrorf(err2.Error())
reportErrorln(err2.Error())
}
}
} else {
err = writeTxnToFile(client, sign, dataDir, walletName, tx, outFilename)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ var sendCmd = &cobra.Command{
err = writeFile(outFilename, protocol.Encode(&stx), 0600)
}
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
}
},
Expand Down Expand Up @@ -1156,7 +1156,7 @@ var dryrunCmd = &cobra.Command{
client := ensureFullClient(dataDir)
accts, err := unmarshalSlice(dumpForDryrunAccts)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
data, err := libgoal.MakeDryrunStateBytes(client, nil, stxns, accts, string(proto), dumpForDryrunFormat.String())
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/goal/clerk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestDeterminePathToSourceFromSourceMap(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 2 additions & 2 deletions cmd/goal/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,11 @@ func writeDryrunReqToFile(client libgoal.Client, txnOrStxn interface{}, outFilen
proto, _ := getProto(protoVersion)
accts, err := unmarshalSlice(dumpForDryrunAccts)
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
data, err := libgoal.MakeDryrunStateBytes(client, txnOrStxn, []transactions.SignedTxn{}, accts, string(proto), dumpForDryrunFormat.String())
if err != nil {
reportErrorf(err.Error())
reportErrorln(err.Error())
}
err = writeFile(outFilename, data, 0600)
return
Expand Down
1 change: 0 additions & 1 deletion cmd/goal/formatting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ func TestBytesToAppCallBytes(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.expected, func(t *testing.T) {
t.Parallel()
acb := encodeBytesAsAppCallBytes(tc.input)
Expand Down
1 change: 0 additions & 1 deletion cmd/goal/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func TestGetMissingCatchpointLabel(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/loadgenerator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func findRootKeys(algodDir string) []*crypto.SignatureSecrets {
var handle db.Accessor
handle, err := db.MakeErasableAccessor(path)
if err != nil {
return nil //nolint:nilerr // don't care, move on
return nil
}
defer handle.Close()

// Fetch an account.Participation from the database
root, err := algodAcct.RestoreRoot(handle)
if err != nil {
return nil //nolint:nilerr // don't care, move on
return nil
}
keylist = append(keylist, root.Secrets())
return nil
Expand Down
Loading

0 comments on commit 7d4e23b

Please sign in to comment.