cmd/go: add a new flag to disable unzipping after go mod download #32605
Comments
/cc @bcmills |
There are a few alternative solutions to this problem that can be considered, in addition to a new flag.
|
/cc @bcmills |
There are a few alternative solutions to this problem that can be considered, in addition to a new flag.
|
The
go mod download
caches the module files into the$GOPATH/pkg/mod/cache/download
by default and extracts them into the$GOPATH/pkg/mod
after the downloads are complete. This's fine. But today I encountered a problem that reminds me that we may need to disable the unzipping operation at some point.So, I ran a program similar to the following using a non-root user:
Then I got the following failed output:
2019/06/14 01:03:21 failed to remove temp dir: unlinkat /var/folders/j6/2330_fdx4tn9t9tx4y117w700000gn/T/foobar128162500/pkg/mod/golang.org/x/text@v0.3.2/codereview.cfg: permission denied exit status 1
Actually, I just need to download the module files and save them somewhere else (not in the
$GOPATH/pkg/mod/cache/download
), then clear the download history after the download is complete. But I got stuck in thatunlinkat
operation.In my scenario, I don't actually need the
go
command to extract the zip files I downloaded into the$GOPATH/pkg/mod
, but thego
command doesn't ask me if it can do that. This not only caused unnecessary computing, but also causes problems such as the inability to remove the unzipped files if you don't have enough permissions.So I think we should probably add a new flag like
-disable-unzip
togo mod download
to disable the unzipping operation.The text was updated successfully, but these errors were encountered: