Adjust downloader functions
This commit is contained in:
parent
06eaff6503
commit
ca09e5efc5
2 changed files with 39 additions and 24 deletions
9
main.go
9
main.go
|
@ -24,8 +24,13 @@ func main() {
|
|||
}
|
||||
|
||||
handleGracefulShutdown()
|
||||
if !downloader.FileExists(appSettings.DataFile) {
|
||||
downloader.DownloadFile(appSettings.DataFile, appSettings.DataURL)
|
||||
|
||||
ctx := downloader.NewContext(appSettings.DataFile, appSettings.DataURL)
|
||||
if !ctx.FileExists() {
|
||||
if err := ctx.Download(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Saved file to %s\n", ctx.Filename)
|
||||
}
|
||||
|
||||
fmt.Printf("Import data from file...\r")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue