Skip to content

Commit

Permalink
chore: Remove outdated pkg (argoproj-labs#19)
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <zachaller@users.noreply.github.com>

Signed-off-by: zachaller <zachaller@users.noreply.github.com>
Signed-off-by: rahul-mourya <rahul.mourya2@ibm.com>
  • Loading branch information
zachaller authored and rahul-mourya committed Jun 6, 2023
1 parent 9ae2e04 commit d3b778c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/extension/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"net/url"
"os"
"path"
Expand Down Expand Up @@ -94,10 +93,7 @@ func (c *extensionContext) Process(ctx context.Context) error {
}

// download all extension files into temp directory
tempDir, err := ioutil.TempDir("", "")
if err != nil {
return fmt.Errorf("failed to create temp dir %v", err)
}
tempDir := os.TempDir()
defer func() {
if err := os.RemoveAll(tempDir); err != nil {
log.Error(err, "Failed to delete temp directory")
Expand Down Expand Up @@ -167,15 +163,15 @@ func (c *extensionContext) saveSnapshot(snapshot sourcesSnapshot) error {
return err
}

if err := ioutil.WriteFile(c.snapshotPath, data, 0755); err != nil {
if err := os.WriteFile(c.snapshotPath, data, 0755); err != nil {
return fmt.Errorf("failed to persist download sources revisions: %v", err)
}
return nil
}

func (c *extensionContext) loadSnapshot() sourcesSnapshot {
var prev sourcesSnapshot
if data, err := ioutil.ReadFile(c.snapshotPath); err == nil {
if data, err := os.ReadFile(c.snapshotPath); err == nil {
_ = json.Unmarshal(data, &prev)
}
return prev
Expand Down

0 comments on commit d3b778c

Please sign in to comment.