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 43e5b0765 refactor(io/gocloud)!: remove deprecated compatibility shims
(#2178)
43e5b0765 is described below
commit 43e5b0765a0c60c9254045606a17a4eafb3ad327
Author: Andrei Tserakhau <[email protected]>
AuthorDate: Tue Oct 13 14:28:24 2026 +0200
refactor(io/gocloud)!: remove deprecated compatibility shims (#2178)
The io/gocloud package kept aliases and wrappers that redirected to the
per-cloud subpackages after the split in #1874 and #1961: BlobFileIO,
KeyExtractor, ErrEmptyObjectKey and ErrUnsupportedObjectAuthority now live
in io/gocloud/blobfs, ParseAWSConfig in io/gocloud/s3, and ParseGCSConfig in
io/gocloud/gcs. Import those packages directly instead.
io/gocloud itself still registers every gocloud-backed FileIO, and its
registration test is kept. This is a breaking change for callers still using
the shims.
Part of the v1.0 API cleanup in #2062.
Signed-off-by: laskoviymishka <[email protected]>
---
io/gocloud/compat_test.go | 108 ---------------------------------------------
io/gocloud/gocloud.go | 42 +-----------------
io/gocloud/gocloud_test.go | 34 ++++++++++++++
3 files changed, 36 insertions(+), 148 deletions(-)
diff --git a/io/gocloud/compat_test.go b/io/gocloud/compat_test.go
deleted file mode 100644
index f2134c4eb..000000000
--- a/io/gocloud/compat_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package gocloud_test
-
-import (
- "context"
- "testing"
-
- "github.com/apache/iceberg-go/internal/schemes"
- "github.com/apache/iceberg-go/io"
- "github.com/apache/iceberg-go/io/gocloud"
- "github.com/apache/iceberg-go/io/gocloud/blobfs"
- "github.com/apache/iceberg-go/io/gocloud/gcs"
- "github.com/apache/iceberg-go/io/gocloud/s3"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-)
-
-// For callers who still have not migrated
-var (
- _ *blobfs.FileIO = (*gocloud.BlobFileIO)(nil)
- _ blobfs.KeyExtractor = gocloud.KeyExtractor(nil)
- _ error = gocloud.ErrEmptyObjectKey
- _ error = gocloud.ErrUnsupportedObjectAuthority
-)
-
-func TestRegistersAllCloudSchemes(t *testing.T) {
- registered := io.GetRegisteredSchemes()
- for _, list := range [][]string{schemes.S3, schemes.GCS, schemes.Azure}
{
- assert.Subset(t, registered, list)
- }
-}
-
-func TestDeprecatedParseConfigWrappers(t *testing.T) {
- ctx := context.Background()
-
- t.Run("ParseGCSConfig", func(t *testing.T) {
- for _, props := range []map[string]string{
- {},
- {io.GCSUseJSONAPI: "true"},
- {io.GCSUseJSONAPI: "false"},
- {io.GCSUseJSONAPI: "not-a-bool"},
- {io.GCSEndpoint: "http://localhost:4443"},
- {io.GCSEndpoint: "http://localhost:4443",
io.GCSUseJSONAPI: "true"},
- } {
- want, got := gcs.ParseGCSConfig(props),
gocloud.ParseGCSConfig(props)
- assert.Equal(t, want, got, "props: %v", props)
- }
- })
-
- t.Run("ParseAWSConfig", func(t *testing.T) {
- for _, tt := range []struct {
- props map[string]string
- static bool
- }{
- {props: map[string]string{}},
- {props: map[string]string{io.S3Region: "us-west-2"}},
- {props: map[string]string{io.S3ClientRegion:
"eu-central-1"}},
- {props: map[string]string{io.S3Region: "us-west-2",
io.S3ClientRegion: "eu-central-1"}},
- {props: map[string]string{"token": "bearer-token"}},
- {props: map[string]string{io.S3AccessKeyID: "ak",
io.S3SecretAccessKey: "sk"}, static: true},
- {props: map[string]string{io.S3AccessKeyID: "ak",
io.S3SecretAccessKey: "sk", io.S3SessionToken: "st"}, static: true},
- } {
- want, wantErr := s3.ParseAWSConfig(ctx, tt.props)
- got, gotErr := gocloud.ParseAWSConfig(ctx, tt.props)
-
- require.NoError(t, wantErr, "props: %v", tt.props)
- require.NoError(t, gotErr, "props: %v", tt.props)
- assert.Equal(t, want.Region, got.Region, "props: %v",
tt.props)
-
- // Retrieving from the default chain would reach the
network, so
- // only static credentials are compared by value.
- if !tt.static {
- continue
- }
-
- wantCreds, err := want.Credentials.Retrieve(ctx)
- require.NoError(t, err)
- gotCreds, err := got.Credentials.Retrieve(ctx)
- require.NoError(t, err)
- assert.Equal(t, wantCreds, gotCreds, "props: %v",
tt.props)
- }
- })
-
- t.Run("error is relayed", func(t *testing.T) {
- props := map[string]string{io.S3RemoteSigningEnabled: "true"}
- _, wantErr := s3.ParseAWSConfig(ctx, props)
- _, gotErr := gocloud.ParseAWSConfig(ctx, props)
- require.Error(t, wantErr)
- require.Error(t, gotErr)
- assert.Equal(t, wantErr.Error(), gotErr.Error())
- })
-}
diff --git a/io/gocloud/gocloud.go b/io/gocloud/gocloud.go
index a53a1cbb2..80c91b486 100644
--- a/io/gocloud/gocloud.go
+++ b/io/gocloud/gocloud.go
@@ -22,45 +22,7 @@
package gocloud
import (
- "context"
-
- "github.com/apache/iceberg-go/io/gocloud/blobfs"
- "github.com/aws/aws-sdk-go-v2/aws"
- "gocloud.dev/blob/gcsblob"
-
_ "github.com/apache/iceberg-go/io/gocloud/azure"
- "github.com/apache/iceberg-go/io/gocloud/gcs"
- "github.com/apache/iceberg-go/io/gocloud/s3"
-)
-
-var (
- // Deprecated: use [blobfs.ErrEmptyObjectKey]
- ErrEmptyObjectKey = blobfs.ErrEmptyObjectKey
- // Deprecated: use [blobfs.ErrUnsupportedObjectAuthority]
- ErrUnsupportedObjectAuthority = blobfs.ErrUnsupportedObjectAuthority
-)
-
-type (
- // BlobFileIO is the FileIO implementation backed by a gocloud.dev
bucket.
- //
- // Deprecated: use [blobfs.FileIO]
- BlobFileIO = blobfs.FileIO
- // KeyExtractor extracts the object key from an input path.
- //
- // Deprecated: use [blobfs.KeyExtractor]
- KeyExtractor = blobfs.KeyExtractor
+ _ "github.com/apache/iceberg-go/io/gocloud/gcs"
+ _ "github.com/apache/iceberg-go/io/gocloud/s3"
)
-
-// ParseAWSConfig parses the S3 properties and returns a configuration.
-//
-// Deprecated: use [s3.ParseAWSConfig]
-func ParseAWSConfig(ctx context.Context, props map[string]string)
(*aws.Config, error) {
- return s3.ParseAWSConfig(ctx, props)
-}
-
-// ParseGCSConfig parses GCS properties and returns bucket options.
-//
-// Deprecated: use [gcs.ParseGCSConfig]
-func ParseGCSConfig(props map[string]string) *gcsblob.Options {
- return gcs.ParseGCSConfig(props)
-}
diff --git a/io/gocloud/gocloud_test.go b/io/gocloud/gocloud_test.go
new file mode 100644
index 000000000..036c99d68
--- /dev/null
+++ b/io/gocloud/gocloud_test.go
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package gocloud_test
+
+import (
+ "testing"
+
+ "github.com/apache/iceberg-go/internal/schemes"
+ "github.com/apache/iceberg-go/io"
+ _ "github.com/apache/iceberg-go/io/gocloud"
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRegistersAllCloudSchemes(t *testing.T) {
+ registered := io.GetRegisteredSchemes()
+ for _, list := range [][]string{schemes.S3, schemes.GCS, schemes.Azure}
{
+ assert.Subset(t, registered, list)
+ }
+}