hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.62k stars 226 forks source link

docs are wrong it seems for "go-getter https://github.com/hashicorp/go-getter.git//testdata" #443

Closed gedw99 closed 9 months ago

gedw99 commented 1 year ago

https://pkg.go.dev/github.com/hashicorp/go-getter@v1.7.1#section-readme

" Subdirectories If you want to download only a specific subdirectory from a downloaded directory, you can specify a subdirectory after a double-slash //. go-getter will first download the URL specified before the double-slash (as if you didn't specify a double-slash), but will then copy the path after the double slash into the target directory.

For example, if you're downloading this GitHub repository, but you only want to download the testdata directory, you can do the following:

https://github.com/hashicorp/go-getter.git//testdata"

go install github.com/hashicorp/go-getter/cmd/go-getter@v1.7.1

# this works ... even though it says it fails
go-getter github.com/hashicorp/go-getter.git//testdata $(PWD)/testdata

# this fails ... even though it says success.
go-getter https://github.com/hashicorp/go-getter.git//testdata $(PWD)/testdata
2023/06/13 16:57:00 success!

Please check it yourself