Skip to content

Commit

Permalink
Merge pull request #175 from mackerelio/update-archiver
Browse files Browse the repository at this point in the history
  • Loading branch information
astj committed Nov 9, 2018
2 parents ad13446 + 4e36192 commit bdb46b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugin/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ func downloadPluginArtifact(u, workdir string) (fpath string, err error) {

// Extract artifact and install plugin
func installByArtifact(artifactFile, bindir, workdir string, overwrite bool) error {
var unarchiver archiver.Unarchiver
// unzip artifact to work directory
fn := archiver.Zip.Open
unarchiver = archiver.DefaultZip
if strings.HasSuffix(artifactFile, ".tar.gz") || strings.HasSuffix(artifactFile, ".tgz") {
fn = archiver.TarGz.Open
unarchiver = archiver.DefaultTarGz
}
err := fn(artifactFile, workdir)
if err != nil {

if err := unarchiver.Unarchive(artifactFile, workdir); err != nil {
return err
}

Expand Down

0 comments on commit bdb46b8

Please sign in to comment.