pkggodevclient

package module
v0.0.0-...-cdb0034 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

README

This is a CLI and Go client for the valuable data at pkg.go.dev, allowing you to programmatically find e.g. what code depends on your code, license information, etc. Since pkg.go.dev has no API, this scrapes the website to extract the data.

View package metadata:

$ go build ./cmd/pkggodev

$ ./pkggodev package-info github.com/ipfs/go-ipfs
Package:                        github.com/ipfs/go-ipfs
IsModule:                       true
IsPackage:                      true
Version:                        v0.10.0
Published:                      2021-09-30
License:                        Apache-2.0, MIT, Apache-2.0, MIT
HasValidGoModFile:              true
HasRedistributableLicense:      true
HasTaggedVersion:               true
HasStableVersion:               false
Repository:                     github.com/ipfs/go-ipfs

Every command supports json output:

$ ./pkggodev package-info github.com/ipfs/go-ipfs --format json | jq
{
  "Package": "github.com/ipfs/go-ipfs",
  "IsModule": true,
  "IsPackage": true,
  "Version": "v0.10.0",
  "Published": "2021-09-30",
  "License": "Apache-2.0, MIT, Apache-2.0, MIT",
  "HasValidGoModFile": true,
  "HasRedistributableLicense": true,
  "HasTaggedVersion": true,
  "HasStableVersion": false,
  "Repository": "github.com/ipfs/go-ipfs"
}

Find packages that import a package:

$ ./pkggodev imported-by github.com/ipfs/go-ipfs | head
gitee.com/Crazyrw/go-ipfs/cmd/ipfs
gitee.com/Crazyrw/go-ipfs/core
gitee.com/Crazyrw/go-ipfs/core/commands
gitee.com/Crazyrw/go-ipfs/core/corehttp
github.com/Angie3120/go-ipfs/cmd/ipfs
github.com/Angie3120/go-ipfs/core
github.com/Angie3120/go-ipfs/core/commands
github.com/Angie3120/go-ipfs/core/corehttp
github.com/BDWare/go-ipfs/cmd/ipfs
github.com/BDWare/go-ipfs/core

Search for packages:

$ ./pkggodev search yaml --limit 2
Package:        gopkg.in/yaml.v2
Version:        v2.4.0
Published:      2020-11-17
ImportedBy:     25575
License:        Apache-2.0
Synopsis:       Package yaml implements YAML support for the Go language.

Package:        gopkg.in/yaml.v3
Version:        v3.0.0-...-496545a
Published:      2021-01-07
ImportedBy:     2634
License:        Apache-2.0, MIT
Synopsis:       Package yaml implements YAML support for the Go language.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found on pkg.go.dev")

Functions

func New

func New(options ...func(c *client)) *client

func WithBaseURL

func WithBaseURL(url string) func(c *client)

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) func(c *client)

Types

type Change

type Change struct {
	URL            string
	Symbol         string
	SymbolSynopsis string
}

TODO: parse the changes and wire them up to Version

type DescribePackageRequest

type DescribePackageRequest struct {
	Package string
}

type ErrorList

type ErrorList struct {
	Errs []error
}

func (*ErrorList) Error

func (e *ErrorList) Error() string

type ImportedBy

type ImportedBy struct {
	Package    string
	ImportedBy []string
}

type ImportedByRequest

type ImportedByRequest struct {
	Package string
}

type Imports

type Imports struct {
	Package                string
	Imports                []string
	ModuleImports          map[string][]string
	StandardLibraryImports []string
}

type ImportsRequest

type ImportsRequest struct {
	Package string
}

type License

type License struct {
	Name     string
	Source   string
	FullText string
}

type LicensesRequest

type LicensesRequest struct {
	Package string
}

type Package

type Package struct {
	Package                   string
	IsModule                  bool
	IsPackage                 bool
	Version                   string
	Published                 string
	License                   string
	HasValidGoModFile         bool
	HasRedistributableLicense bool
	HasTaggedVersion          bool
	HasStableVersion          bool
	Repository                string
}

type SearchRequest

type SearchRequest struct {
	Query string
	Limit int
}

type SearchResult

type SearchResult struct {
	Package    string
	Version    string
	Published  string
	ImportedBy int
	License    string
	Synopsis   string
}

type SearchResults

type SearchResults struct {
	Results []SearchResult
}

type Version

type Version struct {
	MajorVersion string
	FullVersion  string
	Date         string
}

type Versions

type Versions struct {
	Package  string
	Versions []Version
}

type VersionsRequest

type VersionsRequest struct {
	Package string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL