This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new c22034a0 chore(ci): add simplify into formatters (#689)
c22034a0 is described below
commit c22034a0345ac42fc82ccd85945a10dbeda745da
Author: ferhat elmas <[email protected]>
AuthorDate: Thu Jan 22 18:25:33 2026 +0100
chore(ci): add simplify into formatters (#689)
and prefer `any` over `interface{}`.
A suggestion, feel free to close if not needed.
Signed-off-by: ferhat elmas <[email protected]>
---
.golangci.yml | 6 ++++++
catalog/rest/rest_test.go | 12 ++++++------
io/blob.go | 4 ++--
manifest.go | 4 ++--
table/table_test.go | 2 +-
5 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index 42cb0dea..1d63a7cb 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -48,6 +48,12 @@ formatters:
- gofmt
- gofumpt
- goimports
+ settings:
+ gofmt:
+ simplify: true
+ rewrite-rules:
+ - pattern: 'interface{}'
+ replacement: 'any'
exclusions:
generated: lax
paths:
diff --git a/catalog/rest/rest_test.go b/catalog/rest/rest_test.go
index 445ea4b4..5216d6be 100644
--- a/catalog/rest/rest_test.go
+++ b/catalog/rest/rest_test.go
@@ -1150,8 +1150,8 @@ func (r *RestCatalogSuite) TestCreateTable409() {
}
w.WriteHeader(http.StatusConflict)
- errorResponse := map[string]interface{}{
- "error": map[string]interface{}{
+ errorResponse := map[string]any{
+ "error": map[string]any{
"message": "Table already exists:
fokko.already_exists in warehouse 8bcb0838-50fc-472d-9ddb-8feb89ef5f1e",
"type": "AlreadyExistsException",
"code": 409,
@@ -1429,8 +1429,8 @@ func (r *RestCatalogSuite) TestDropTable404() {
}
w.WriteHeader(http.StatusNotFound)
- errorResponse := map[string]interface{}{
- "error": map[string]interface{}{
+ errorResponse := map[string]any{
+ "error": map[string]any{
"message": "Table does not exist: fokko.table",
"type": "NoSuchTableException",
"code": 404,
@@ -1933,8 +1933,8 @@ func (r *RestCatalogSuite) TestDropView404() {
}
w.WriteHeader(http.StatusNotFound)
- errorResponse := map[string]interface{}{
- "error": map[string]interface{}{
+ errorResponse := map[string]any{
+ "error": map[string]any{
"message": "The given view does not exist",
"type": "NoSuchViewException",
"code": 404,
diff --git a/io/blob.go b/io/blob.go
index 8fae7be5..fa09f7c5 100644
--- a/io/blob.go
+++ b/io/blob.go
@@ -62,7 +62,7 @@ func (f *blobOpenFile) ReadAt(p []byte, off int64) (n int,
err error) {
func (f *blobOpenFile) Name() string { return f.name }
func (f *blobOpenFile) Mode() fs.FileMode { return fs.ModeIrregular }
-func (f *blobOpenFile) Sys() interface{} { return f.b }
+func (f *blobOpenFile) Sys() any { return f.b }
func (f *blobOpenFile) IsDir() bool { return false }
func (f *blobOpenFile) Stat() (fs.FileInfo, error) { return f, nil }
@@ -196,6 +196,6 @@ type blobWriteFile struct {
}
func (f *blobWriteFile) Name() string { return f.name }
-func (f *blobWriteFile) Sys() interface{} { return f.b }
+func (f *blobWriteFile) Sys() any { return f.b }
func (f *blobWriteFile) Close() error { return f.Writer.Close()
}
func (f *blobWriteFile) Write(p []byte) (int, error) { return
f.Writer.Write(p) }
diff --git a/manifest.go b/manifest.go
index f3f73ac0..5e591a99 100644
--- a/manifest.go
+++ b/manifest.go
@@ -1788,7 +1788,7 @@ func (d *dataFile) convertAvroValueToIcebergType(v any,
fieldID int) any {
return Timestamp(v.(int64))
case avro.Decimal:
- if unionMap, ok := v.(map[string]interface{}); ok {
+ if unionMap, ok := v.(map[string]any); ok {
if val, ok := unionMap["fixed"]; ok {
if bigRatValue, ok := val.(*big.Rat);
ok {
scale :=
d.fieldIDToFixedSize[fieldID]
@@ -1807,7 +1807,7 @@ func (d *dataFile) convertAvroValueToIcebergType(v any,
fieldID int) any {
return v
case avro.UUID:
- if unionMap, ok := v.(map[string]interface{}); ok {
+ if unionMap, ok := v.(map[string]any); ok {
if val, ok := unionMap["uuid"]; ok {
if uuidArr, ok := val.([16]byte); ok {
return uuid.UUID(uuidArr)
diff --git a/table/table_test.go b/table/table_test.go
index f524142a..cf5ae1ba 100644
--- a/table/table_test.go
+++ b/table/table_test.go
@@ -2023,7 +2023,7 @@ func (t *TableTestSuite)
TestMetadataCompressionRoundTrip() {
t.Require().NoError(err)
// Verify the decompressed content is valid JSON
- var metadata map[string]interface{}
+ var metadata map[string]any
err = json.Unmarshal(decompressed, &metadata)
t.Require().NoError(err)