https://github.com/dakimura/gomodmrcli
https://github.com/dakimura/gomodmrcli
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dakimura/gomodmrcli
- Owner: dakimura
- License: mit
- Created: 2021-07-29T11:36:50.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-06T04:32:41.000Z (almost 4 years ago)
- Last Synced: 2025-01-29T07:26:55.769Z (4 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# modpxycli
[](https://github.com/dakimura/gomodmrcli/actions?query=branch%3Amain)
[](https://codecov.io/gh/dakimura/gomodmrcli)
[](https://goreportcard.com/report/github.com/gin-gonic/gin)
[](https://pkg.go.dev/github.com/dakimura/gomodmrcli?tab=doc)
[](https://gitter.im/dakimura/gomodmrcli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://sourcegraph.com/github.com/dakimura/gomodmrcli?badge)
[](https://www.codetriage.com/dakimura/gomodmrcli)
[](https://github.com/dakimura/gomodmrcli/releases)
[](https://www.tickgit.com/browse?repo=github.com/dakimura/gomodmrcli)API client for https://index.golang.org/ and https://proxy.golang.org/
## Installation
```
$ go get -u github.com/dakimura/gomodmrcli
```
and import in your code
```
import "github.com/dakimura/gomodmrcli"
```## Quick Start
```go
package mainimport (
"fmt"
"net/http"
"time""github.com/dakimura/gomodmrcli"
)func main() {
defaultHttpClient := new(http.Client)
// --- e.g. get dependencies of the module
modulePath := "google.golang.org/protobuf"
moduleVersion := "v1.26.0"
proxyCli := gomodmrcli.NewProxyClient(defaultHttpClient)
mf, _ := proxyCli.Mod(modulePath, moduleVersion, false)fmt.Printf("%s@%s is depending on:\n", modulePath, moduleVersion)
for _, req := range mf.Require {
fmt.Println(req.Syntax.Token[0])
}// --- e.g. get modules recently synchronized to the official go mod proxy
indexCli := gomodmrcli.NewIndexClient(defaultHttpClient)
indices, _ := indexCli.Index(time.Now().Add(-24*time.Hour), 5, false)fmt.Println()
fmt.Println("Recently updated modules are:")
for _, index := range indices {
fmt.Println(index.Path)
}
}
```