https://github.com/sagikazarmark/moddown
Go Module downloader
https://github.com/sagikazarmark/moddown
Last synced: 7 months ago
JSON representation
Go Module downloader
- Host: GitHub
- URL: https://github.com/sagikazarmark/moddown
- Owner: sagikazarmark
- License: mit
- Created: 2020-08-03T19:02:56.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-19T15:44:23.000Z (over 4 years ago)
- Last Synced: 2025-03-06T18:52:46.748Z (7 months ago)
- Language: Go
- Size: 49.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Module downloader

[](https://goreportcard.com/report/github.com/sagikazarmark/moddown)
[](https://pkg.go.dev/mod/github.com/sagikazarmark/moddown)`moddown` is a simplified version of [fetch_repo](https://github.com/bazelbuild/bazel-gazelle/tree/5c00b77/cmd/fetch_repo).
It focuses on downloading a module using `go mod download`.
Unlike `fetch_repo`, this tool [does not create a dummy module](https://github.com/golang/go/issues/29522)
and uses the [-modcacherw](https://golang.org/doc/go1.14#go-flags) flag to make the cache writable (removable),
so it requires at least Go 1.14.## Usage
The basic functionality of `moddown` includes:
- downloading a module (by calling `go mod download` under the hood)
- checking the module sum against a known value
- copying files to a destination directory```bash
./moddown -sum h1:snD5ODyv4c9DOBBZh645dy/TziVHZivuFtRRMZP8zK8= -dest ./emperror emperror.dev/errors@v0.4.2
````moddown` can also use existing module information and delegate downloading to the Go tool:
```bash
go mod download -modcacherw -x -json emperror.dev/errors@v0.4.2 > mod.json
./moddown -sum h1:snD5ODyv4c9DOBBZh645dy/TziVHZivuFtRRMZP8zK8= -f mod.json# OR pipe from stdin directly
go mod download -modcacherw -x -json emperror.dev/errors@v0.4.2 | ./moddown -v -sum h1:snD5ODyv4c9DOBBZh645dy/TziVHZivuFtRRMZP8zK8= -f -
```Last, but not least: you can enable verbose logging with `-v`.
## Development
Contributions are welcome! :)
1. Clone the repository
1. Make changes on a new branch
1. Run the test suite:
```bash
./pleasew build
./pleasew test
./pleasew lint
```
1. Commit, push and open a PR## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.