Skip to content

Commit f65e02d

Browse files
authored
fix: lint explicitly ignore various close errors (#1684)
Signed-off-by: Terry Howe <[email protected]>
1 parent dbc56a9 commit f65e02d

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

cmd/oras/root/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func runAttach(cmd *cobra.Command, opts *attachOptions) error {
145145
if err != nil {
146146
return err
147147
}
148-
defer store.Close()
148+
defer func() { _ = store.Close() }()
149149

150150
dst, err := opts.NewTarget(opts.Common, logger)
151151
if err != nil {

cmd/oras/root/blob/fetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (opts *fetchBlobOptions) doFetch(ctx context.Context, src oras.ReadOnlyTarg
148148
if err != nil {
149149
return ocispec.Descriptor{}, err
150150
}
151-
defer rc.Close()
151+
defer func() { _ = rc.Close() }()
152152
vr := content.NewVerifyReader(rc, desc)
153153

154154
// outputs blob content if "--output -" is used

cmd/oras/root/blob/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func pushBlob(cmd *cobra.Command, opts *pushBlobOptions) (err error) {
123123
if err != nil {
124124
return err
125125
}
126-
defer rc.Close()
126+
defer func() { _ = rc.Close() }()
127127

128128
statusHandler, metadataHandler := display.NewBlobPushHandler(opts.Printer, opts.OutputDescriptor, opts.Pretty.Pretty, desc, opts.TTY)
129129
if err := doPush(ctx, statusHandler, target, desc, rc); err != nil {

cmd/oras/root/manifest/index/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Example - Update an index and output the index to stdout, auto push will be disa
105105
func updateIndex(cmd *cobra.Command, opts updateOptions) error {
106106
// if no update flag is used, do nothing
107107
if !updateFlagsUsed(cmd.Flags()) {
108-
opts.Printer.Println("Nothing to update as no change is requested")
108+
_ = opts.Printer.Println("Nothing to update as no change is requested")
109109
return nil
110110
}
111111
ctx, logger := command.GetLogger(cmd, &opts.Common)

cmd/oras/root/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func runPush(cmd *cobra.Command, opts *pushOptions) error {
186186
if err != nil {
187187
return err
188188
}
189-
defer store.Close()
189+
defer func() { _ = store.Close() }()
190190
if opts.manifestConfigRef != "" {
191191
path, cfgMediaType, err := fileref.Parse(opts.manifestConfigRef, oras.MediaTypeUnknownConfig)
192192
if err != nil {

0 commit comments

Comments
 (0)