zeroshade commented on code in PR #2635:
URL: https://github.com/apache/iceberg-go/pull/2635#discussion_r4645566870


##########
io/gocloud/blobfs/blob.go:
##########
@@ -373,12 +384,12 @@ func (bfs *FileIO) NewWriter(ctx context.Context, path 
string, overwrite bool, o
                        return nil, &fs.PathError{Op: "new writer", Path: path, 
Err: fs.ErrInvalid}
                }
        }
-       bw, err := bfs.Bucket.NewWriter(ctx, key, opts)
+       bw, err := bfs.NewWriter(ctx, key, opts)

Review Comment:
   nit: now that the wrapper of the same name is gone, this resolves to the 
embedded `Bucket.NewWriter` implicitly. The previous `bfs.Bucket.NewWriter` 
spelling made it clear which method is meant.
   
   ```suggestion
        bw, err := bfs.Bucket.NewWriter(ctx, key, opts)
   ```



##########
io/gocloud/blobfs/blob.go:
##########
@@ -347,15 +358,15 @@ func (bfs *FileIO) WriteFile(ctx context.Context, name 
string, content []byte) e
        return bfs.WriteAll(ctx, key, content, nil)
 }
 
-// NewWriter returns a Writer that writes to the blob stored at path.
+// newWriter returns a writer that writes to the blob stored at path.
 // A nil WriterOptions is treated the same as the zero value.
 //
 // If overwrite is disabled and a blob with this path already exists,
 // an error will be returned.
 //
-// The caller must call Close on the returned Writer, even if the write is
+// The caller must call Close on the returned writer, even if the write is
 // aborted.
-func (bfs *FileIO) NewWriter(ctx context.Context, path string, overwrite bool, 
opts *blob.WriterOptions) (w *Writer, err error) {
+func (bfs *fileIO) newWriter(ctx context.Context, path string, overwrite bool, 
opts *blob.WriterOptions) (w *writer, err error) {

Review Comment:
   With `NewWriter` unexported, the only production caller is `Create`, which 
always passes `overwrite=true, opts=nil`. The `!overwrite` Exists branch and 
the `opts` parameter are now reachable only from tests (blob_test.go:563 and 
:1631). Since this PR is an API cleanup anyway, could `newWriter` be folded 
into `Create`, and the test that only covers the unreachable branch dropped?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to