diff --git a/config.go b/config.go index 4f4ede1..ece996b 100644 --- a/config.go +++ b/config.go @@ -47,7 +47,7 @@ type Config struct { // Context context.Context // - OnProgress *func(percent int64, current, total int64) + OnProgress func(percent int64, current, total int64) // BasicAuth BasicAuth // diff --git a/execute.go b/execute.go index 5ada448..ad61faa 100644 --- a/execute.go +++ b/execute.go @@ -415,7 +415,7 @@ func (f *Fetch) Execute() (*Response, error) { progress := &Progress{ Total: resp.ContentLength, Current: 0, - Reporter: *f.config.OnProgress, + Reporter: f.config.OnProgress, } _, err = io.Copy(io.MultiWriter(file, progress), reader) diff --git a/fetch.go b/fetch.go index 7d3e615..01efdef 100644 --- a/fetch.go +++ b/fetch.go @@ -74,7 +74,7 @@ func (f *Fetch) SetDownloadFilePath(filepath string) *Fetch { // SetProgressCallback sets the progress callback func (f *Fetch) SetProgressCallback(callback func(percent int64, current, total int64)) *Fetch { - f.config.OnProgress = &callback + f.config.OnProgress = callback return f }