Skip to content

Commit 010b471

Browse files
committed
fix old dependencies and unused code
1 parent 6e1d110 commit 010b471

File tree

1 file changed

+1
-53
lines changed

1 file changed

+1
-53
lines changed

update.go

+1-53
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ import (
3838
"errors"
3939
"fmt"
4040
log "github.com/Sirupsen/logrus"
41-
"github.com/inconshreveable/go-update"
4241
"github.com/kardianos/osext"
4342
"github.com/kr/binarydist"
4443
"github.com/pivotal-golang/archiver/extractor"
45-
patch "github.com/sanderhahn/gozip/patchzip"
44+
"gopkg.in/inconshreveable/go-update.v0"
4645
"io"
4746
"io/ioutil"
4847
"math/rand"
@@ -69,57 +68,6 @@ func IsZip(path string) bool {
6968
return false
7069
}
7170

72-
func Zip(path string, dirs []string) (err error) {
73-
if IsZip(path) {
74-
return errors.New(path + " is already a zip file")
75-
}
76-
77-
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
78-
if err != nil {
79-
return
80-
}
81-
defer f.Close()
82-
83-
startoffset, err := f.Seek(0, os.SEEK_END)
84-
if err != nil {
85-
return
86-
}
87-
88-
w := patch.NewWriterAt(f, startoffset)
89-
90-
for _, dir := range dirs {
91-
err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
92-
if err != nil {
93-
return err
94-
}
95-
96-
fh, err := patch.FileInfoHeader(info)
97-
if err != nil {
98-
return err
99-
}
100-
fh.Name = path
101-
102-
p, err := w.CreateHeader(fh)
103-
if err != nil {
104-
return err
105-
}
106-
if !info.IsDir() {
107-
content, err := ioutil.ReadFile(path)
108-
if err != nil {
109-
return err
110-
}
111-
_, err = p.Write(content)
112-
if err != nil {
113-
return err
114-
}
115-
}
116-
return err
117-
})
118-
}
119-
err = w.Close()
120-
return
121-
}
122-
12371
func Unzip(zippath string, destination string) (err error) {
12472
r, err := zip.OpenReader(zippath)
12573
if err != nil {

0 commit comments

Comments
 (0)