Skip to content

Commit

Permalink
Improve linting (#155)
Browse files Browse the repository at this point in the history
* added staticcheck

* make staticcheck happy

---------

Co-authored-by: lmittmann <[email protected]>
  • Loading branch information
lmittmann and lmittmann authored Jun 14, 2024
1 parent 43b46de commit 8ab4472
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
name: Go

on:
- push
- pull_request
push:
branches:
- main
pull_request:

jobs:
fmt_vet:
name: Fmt & Vet
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: "1.22"
- name: go fmt
run: |
output=$(gofmt -s -d .)
echo "$output"
test -z "$output"
- name: go vet
run: go vet ./...
- name: install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: staticcheck
run: staticcheck ./...

test:
name: Test
Expand All @@ -28,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: "1.22"
- name: go test
run: go test -covermode atomic -coverprofile=covprofile ./...
- name: install goveralls
Expand Down
11 changes: 0 additions & 11 deletions internal/abi/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ var (
reflect.TypeOf(&big.Int{}): {},
reflect.TypeOf(big.Int{}): {},
}

typeBig = reflect.TypeOf(&big.Int{})
)

// Copy shallow copies the value src to dst. If src is an anonymous struct or an
Expand Down Expand Up @@ -211,15 +209,6 @@ func setArray(dst, src reflect.Value) error {
return nil
}

// indirect recursively dereferences the value until it either gets the value
// or finds a big.Int
func indirect(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Pointer && v.Type() != typeBig {
return indirect(v.Elem())
}
return v
}

func dereference(v reflect.Value) reflect.Value {
for v.Kind() == reflect.Pointer && v.Elem().Kind() == reflect.Pointer {
v = v.Elem()
Expand Down

0 comments on commit 8ab4472

Please sign in to comment.