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


##########
catalog/internal/utils.go:
##########
@@ -55,10 +56,19 @@ func WriteTableMetadata(metadata table.Metadata, fs 
icebergio.WriteFileIO, loc s
 
        var writer io.Writer = out
        var compressWriter io.WriteCloser
-       if compression == table.MetadataCompressionCodecGzip {
+       switch compression {
+       case table.MetadataCompressionCodecGzip:
                compressWriter = gzip.NewWriter(out)
                writer = compressWriter
                defer internal.CheckedClose(compressWriter, &err)
+       case table.MetadataCompressionCodecZstd:
+               enc, zErr := zstd.NewWriter(out)
+               if zErr != nil {
+                       return zErr
+               }
+               compressWriter = enc
+               writer = compressWriter
+               defer internal.CheckedClose(compressWriter, &err)

Review Comment:
   we don't need the `compressWriter` intermediate here.
   
   we can just use `defer internal.CheckedClose(enc, &err)` right? 
`compressWriter` doesn't need to be pre-declared



-- 
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