Skip to content

Commit dfd2e06

Browse files
committed
Simplify vsix write
1 parent b5c7d0f commit dfd2e06

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

storage/local.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package storage
22

33
import (
4-
"bytes"
54
"context"
65
"fmt"
76
"io"
@@ -47,16 +46,8 @@ func (s *Local) AddExtension(ctx context.Context, manifest *VSIXManifest, vsix [
4746
}
4847

4948
// Copy the VSIX itself as well.
50-
id := ExtensionID(manifest)
51-
dst, err := os.OpenFile(
52-
filepath.Join(dir, fmt.Sprintf("%s.vsix", id)),
53-
os.O_WRONLY|os.O_CREATE|os.O_TRUNC,
54-
0o644)
55-
if err != nil {
56-
return "", err
57-
}
58-
defer dst.Close()
59-
_, err = io.Copy(dst, bytes.NewReader(vsix))
49+
vsixPath := filepath.Join(dir, fmt.Sprintf("%s.vsix", ExtensionID(manifest)))
50+
err = os.WriteFile(vsixPath, vsix, 0o644)
6051
if err != nil {
6152
return "", err
6253
}

0 commit comments

Comments
 (0)