File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 6
6
"io"
7
7
"io/ioutil"
8
8
"log"
9
+ "net/http"
9
10
"os"
10
11
"os/exec"
11
12
"os/user"
@@ -75,6 +76,30 @@ func findVendorDirs(dir string) ([]string, error) {
75
76
return vendorDirs , err
76
77
}
77
78
79
+ func downloadFile (filename , url string ) error {
80
+ dst , err := os .Create (filename )
81
+ if err != nil {
82
+ return err
83
+ }
84
+ defer dst .Close ()
85
+
86
+ resp , err := http .Get (url )
87
+ if err != nil {
88
+ return err
89
+ }
90
+ defer resp .Body .Close ()
91
+ if resp .StatusCode != 200 {
92
+ return fmt .Errorf (resp .Status )
93
+ }
94
+
95
+ _ , err = io .Copy (dst , resp .Body )
96
+ if err != nil {
97
+ return err
98
+ }
99
+
100
+ return nil
101
+ }
102
+
78
103
// upstream describes the upstream repo we are about to package.
79
104
type upstream struct {
80
105
tarPath string // path to the generated orig tarball tempfile
You can’t perform that action at this time.
0 commit comments