fishworks / gofish

Keep your fish fresh! :tropical_fish:
https://gofi.sh
Apache License 2.0
811 stars 64 forks source link

Download file should ensure directory exists #185

Closed Dreamacro closed 3 years ago

Dreamacro commented 3 years ago

When I upgraded go 1.16.5, I got the following output:

==> Installing go...
Error: failed to download package for OS/arch darwin/amd64 with URL https://dl.google.com/go/go1.16.5.darwin-amd64.tar.gz to filepath /Users/Dreamacro/Library/Caches/gofish/go-1.16.5-darwin-amd64.tar.gz

I tried to uninstall go, or anything I thought might help, but nothing worked.

Finally, I run mkdir /Users/Dreamacro/Library/Caches/gofish and everything work again. Maybe the cache directory was cleaned by another tool.

So I think it should ensure directory exists before download

bacongobbler commented 3 years ago

Did you make sure you ran gofish init before calling gofish install? That command will create the cache directory for you.

Dreamacro commented 3 years ago

@bacongobbler I already run gofish init on my first install gofish. When I use some software like cleanmymac, the cache directory may be deleted.

So if I run gofish init again, isn't that a bit weird?

bacongobbler commented 3 years ago

Fair enough. There are better ways to fix this than hardcoding "if missing, create" everywhere in the codebase though. It's a really poor practice that'll become quickly unmaintainable.

I'll see about implementing lazy lookups in pkg/home.

bacongobbler commented 3 years ago

use gofish init for the time being.