Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-41887: [Go] Run linter via pre-commit #41888

Merged
merged 13 commits into from
Jun 3, 2024
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ __debug_bin
.envrc

# Develocity
.mvn/.gradle-enterprise/
.mvn/.develocity/

# rat
filtered_rat.txt
rat.txt
zeroshade marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,8 @@ repos:
'--disable',
'dangling-hyphen,line-too-long',
]
- repo: https://github.com/dnephin/pre-commit-golang
tscottcoombes1 marked this conversation as resolved.
Show resolved Hide resolved
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-imports
zeroshade marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion go/arrow/array/bufferbuilder_numeric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"testing"
"unsafe"

"github.com/apache/arrow/go/v17/arrow/memory"
"github.com/apache/arrow/go/v17/arrow/endian"
"github.com/apache/arrow/go/v17/arrow/memory"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion go/arrow/array/numeric.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions go/arrow/array/numeric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package array_test

import (
import (
"math"
"reflect"
"testing"
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestFloat16MarshalJSON(t *testing.T) {

bldr := array.NewFloat16Builder(pool)
defer bldr.Release()

jsonstr := `[0, 1, 2, 3, "NaN", "NaN", 4, 5, "+Inf", "-Inf"]`

bldr.Append(float16.New(0))
Expand All @@ -158,7 +158,6 @@ func TestFloat16MarshalJSON(t *testing.T) {
bldr.Append(float16.Inf())
bldr.Append(float16.Inf().Negate())


expected := bldr.NewFloat16Array()
defer expected.Release()
expected_json, err := expected.MarshalJSON()
Expand All @@ -172,7 +171,7 @@ func TestFloat32MarshalJSON(t *testing.T) {

bldr := array.NewFloat32Builder(pool)
defer bldr.Release()

jsonstr := `[0, 1, "+Inf", 2, 3, "NaN", "NaN", 4, 5, "-Inf"]`

bldr.Append(0)
Expand All @@ -186,10 +185,9 @@ func TestFloat32MarshalJSON(t *testing.T) {
bldr.Append(5)
bldr.Append(float32(math.Inf(-1)))


expected := bldr.NewFloat32Array()
defer expected.Release()

expected_json, err := expected.MarshalJSON()
assert.NoError(t, err)

Expand Down Expand Up @@ -223,7 +221,7 @@ func TestFloat64MarshalJSON(t *testing.T) {
assert.NoError(t, err)

assert.JSONEq(t, jsonstr, string(expected_json))

}

func TestUnmarshalSpecialFloat(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions go/arrow/array/numericbuilder.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/arrow/array/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestRecord(t *testing.T) {
if _, err := rec.SetColumn(0, col2_1); err == nil {
t.Fatalf("expected an error")
}
newRec, err := rec.SetColumn(1, col2_1);
newRec, err := rec.SetColumn(1, col2_1)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
Expand Down
5 changes: 3 additions & 2 deletions go/arrow/flight/gen/flight/Flight.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/arrow/flight/gen/flight/FlightSql.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go/arrow/flight/gen/flight/Flight_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/arrow/float16/float16.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (n Num) Signbit() bool { return (n.bits & 0x8000) != 0 }

func (n Num) IsNaN() bool { return (n.bits & 0x7fff) > 0x7c00 }

func (n Num) IsInf() bool {return (n.bits & 0x7c00) == 0x7c00 }
func (n Num) IsInf() bool { return (n.bits & 0x7c00) == 0x7c00 }

func (n Num) IsZero() bool { return (n.bits & 0x7fff) == 0 }

Expand Down
1 change: 1 addition & 0 deletions go/arrow/gen-flatbuffers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build ignore
// +build ignore

package main
Expand Down
1 change: 1 addition & 0 deletions go/arrow/internal/debug/assert_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !assert
tscottcoombes1 marked this conversation as resolved.
Show resolved Hide resolved
// +build !assert

package debug
Expand Down
1 change: 1 addition & 0 deletions go/arrow/internal/debug/assert_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build assert
// +build assert

package debug
Expand Down
6 changes: 2 additions & 4 deletions go/arrow/internal/debug/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
/*
Package debug provides APIs for conditional runtime assertions and debug logging.


Using Assert
# Using Assert

To enable runtime assertions, build with the assert tag. When the assert tag is omitted,
the code for the assertion will be omitted from the binary.


Using Log
# Using Log

To enable runtime debug logs, build with the debug tag. When the debug tag is omitted,
the code for logging will be omitted from the binary.
Expand Down
1 change: 1 addition & 0 deletions go/arrow/internal/debug/log_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !debug
// +build !debug

package debug
Expand Down
1 change: 1 addition & 0 deletions go/arrow/internal/debug/log_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build debug
// +build debug

package debug
Expand Down
1 change: 1 addition & 0 deletions go/arrow/internal/debug/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build debug || assert
// +build debug assert

package debug
Expand Down
2 changes: 1 addition & 1 deletion go/arrow/internal/flatbuf/Binary.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions go/arrow/internal/flatbuf/BinaryView.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions go/arrow/internal/flatbuf/Block.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions go/arrow/internal/flatbuf/BodyCompression.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go/arrow/internal/flatbuf/BodyCompressionMethod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading