func ExtractZip(zipfile, destDir string) error {
	r, err := zip.OpenReader(zipfile)
	if err != nil {
		return err
	}
	defer r.Close()
	for _, f := range r.File {
		path := filepath.Join(destDir, filepath.Clean(f.Name))
		rc, err := f.Open()
		if err != nil {
			return err
		}
		if f.FileInfo().IsDir() {
			err = os.MkdirAll(path, f.Mode())
		} else {
			err = writeToFile(rc, path, f.Mode())
		}
		rc.Close()
		if err != nil {
			return err
		}
	}
	return nil
}
ExtractZip extracts zipfile to destDir
package libbuildpack
import (
	"archive/tar"
	"archive/zip"
	"compress/gzip"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"math/rand"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"time"
)
func init() {
	rand.Seed(time.Now().UnixNano())
}
func MoveDirectory(srcDir, destDir string) error {
	destExists, _ := FileExists(destDir)
	if !destExists {
		return os.Rename(srcDir, destDir)
	}
	files, err := ioutil.ReadDir(srcDir)
	if err != nil {
		return err
	}
	for _, f := range files {
		src := filepath.Join(srcDir, f.Name())
		dest := filepath.Join(destDir, f.Name())
		if exists, err := FileExists(dest); err != nil {
			return err
		} else if !exists {
			if m := f.Mode(); m&os.ModeSymlink != 0 {
				if err = moveSymlinks(src, dest); err != nil {
					return err
				}
			}
			if err = os.Rename(src, dest); err != nil {
				return err
			}
		} else {
			if f.IsDir() {
				if err = MoveDirectory(src, dest); err != nil {
					return err
				}
			}
		}
	}
	return nil
}
func CopyDirectory(srcDir, destDir string) error {
	destExists, _ := FileExists(destDir)
	if !destExists {
		return errors.New("destination dir must exist")
	}
	files, err := ioutil.ReadDir(srcDir)
	if err != nil {
		return err
	}
	for _, f := range files {
		src := filepath.Join(srcDir, f.Name())
		dest := filepath.Join(destDir, f.Name())
		if m := f.Mode(); m&os.ModeSymlink != 0 {
			if err = moveSymlinks(src, dest); err != nil {
				return err
			}
		} else if f.IsDir() {
			err = os.MkdirAll(dest, f.Mode())
			if err != nil {
				return err
			}
			if err := CopyDirectory(src, dest); err != nil {
				return err
			}
		} else {
			rc, err := os.Open(src)
			if err != nil {
				return err
			}
			err = writeToFile(rc, dest, f.Mode())
			if err != nil {
				rc.Close()
				return err
			}
			rc.Close()
		}
	}
	return nil
}
func moveSymlinks(src, dest string) error {
	target, err := os.Readlink(src)
	if err != nil {
		return fmt.Errorf("Error while reading symlink '%s': %v", src, err)
	}
	if err := os.Symlink(target, dest); err != nil {
		return fmt.Errorf("Error while creating '%s' as symlink to '%s': %v", dest, target, err)
	}
	return nil
}