Skip to content

Commit

Permalink
Golang v20 upgrade/compatibility changes. (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf committed Jun 16, 2023
1 parent 4c59abc commit 4e48617
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 261 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
- run: git fetch --force --tags

- name: go dependency
uses: actions/setup-go@v3
uses: actions/setup-go@v4.0.1
with:
go-version-file: 'go.mod'

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3.5.3
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install specific golang
uses: actions/setup-go@v2
uses: actions/setup-go@v4.0.1
with:
go-version: '1.17.13'
go-version: '1.20.5'
- name: Check format
run: test -z `go fmt ./...`
- name: Vet
run: go vet ./...
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2
uses: reviewdog/action-golangci-lint@v2.3.1
with:
golangci_lint_version: "v1.47.3"
golangci_lint_version: "v1.53.2"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
go_version: "1.17.13"
go_version: "1.20.5"
reporter: "github-pr-review"
tool_name: "Lint Errors"
level: "error"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
- run: git fetch --force --tags

- name: Install go
uses: actions/setup-go@v3
uses: actions/setup-go@v4.0.1
with:
go-version-file: 'go.mod'

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _*.json
__pycache__
e2e_tests/dist
e2e_tests/build
e2e_tests/*egg-info*
e2e_tests/**/*egg-info*
e2e_tests/src/*egg-info*
.venv

Expand Down
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ run:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- exportloopref
- gci
Expand All @@ -16,10 +15,8 @@ linters:
- misspell
- revive
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

linters-settings:
gci:
Expand Down Expand Up @@ -58,3 +55,6 @@ issues:
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop

# revive: ignore some rules
- "^package-comments: should have a package comment"
5 changes: 2 additions & 3 deletions cmd/conduit-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path"
"strings"
Expand All @@ -20,7 +19,7 @@ const footerPrefix = "Footer\n"
// and writes a markdown file to the outputDir containing mkdocs-style documentation for the Config struct
func generateMd(configPath string, outputDir string) error {
// parse the config file
bytes, err := ioutil.ReadFile(configPath)
bytes, err := os.ReadFile(configPath)
if err != nil {
return err
}
Expand Down Expand Up @@ -118,7 +117,7 @@ func main() {
flag.Parse()

usage := "USAGE: //go:generate conduit-docs <path-to-output-dir>"
// go:generate conduit-docs [path]
//go:generate conduit-docs [path]
if len(flag.Args()) == 1 {
err := generateMd(os.Getenv("GOFILE"), flag.Arg(0))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion conduit/plugins/exporters/example/example_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (exp *exampleExporter) Close() error {
}

// Receive is the main handler function for blocks
func (exp *exampleExporter) Receive(exportData data.BlockData) error {
func (exp *exampleExporter) Receive(_ data.BlockData) error {
panic("not implemented")
}

Expand Down
3 changes: 1 addition & 2 deletions conduit/plugins/exporters/filewriter/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"strings"

Expand Down Expand Up @@ -69,7 +68,7 @@ func EncodeJSONToFile(filename string, v interface{}, pretty bool) error {
// DecodeJSONFromFile is used to decode a file to an object.
func DecodeJSONFromFile(filename string, v interface{}, strict bool) error {
// Streaming into the decoder was slow.
fileBytes, err := ioutil.ReadFile(filename)
fileBytes, err := os.ReadFile(filename)
if err != nil {
return fmt.Errorf("DecodeJSONFromFile(): failed to read %s: %w", filename, err)
}
Expand Down
2 changes: 1 addition & 1 deletion conduit/plugins/exporters/noop/noop_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (exp *noopExporter) Metadata() plugins.Metadata {
return metadata
}

func (exp *noopExporter) Init(_ context.Context, initProvider data.InitProvider, cfg plugins.PluginConfig, _ *logrus.Logger) error {
func (exp *noopExporter) Init(_ context.Context, _ data.InitProvider, cfg plugins.PluginConfig, _ *logrus.Logger) error {
if err := cfg.UnmarshalConfig(&exp.cfg); err != nil {
return fmt.Errorf("init failure in unmarshalConfig: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/algorand/conduit

go 1.17
go 1.20

require (
github.com/algorand/go-algorand-sdk/v2 v2.0.0-20230531123858-3a0efd6a6398
Expand Down
Loading

0 comments on commit 4e48617

Please sign in to comment.