generator

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDeps

func GetDeps(cmd GoList) (map[string]DepPackage, error)

GetDeps ... GetDeps converts GoList output into DepPackage format.

Types

type DepModule

type DepModule struct {
	Path    string     `json:"Path"`
	Main    bool       `json:"Main"`
	Version string     `json:"Version"`
	Replace *DepModule `json:"Replace"`
}

DepModule ... Module structure from deps json

type DepPackage

type DepPackage struct {
	Root       string    `json:"Root"`
	ImportPath string    `json:"ImportPath"`
	Module     DepModule `json:"Module"`
	Standard   bool      `json:"Standard"`
	Imports    []string  `json:"Imports"`
	Deps       []string  `json:"Deps"`
}

DepPackage ... Package structure from deps json

type Dependency

type Dependency struct {
	Name         string       `json:"package"`
	Version      string       `json:"version"`
	Dependencies []Dependency `json:"deps,omitempty"`
}

Dependency ... Direct and transitive dependency details.

type GoList

type GoList interface {
	ReadCloser() io.ReadCloser
	Wait() error
}

GoList ... Interface to be implemented to execute go list command.

type GoListCmd

type GoListCmd struct {
	// contains filtered or unexported fields
}

GoListCmd ... Go list command structure.

func RunGoList

func RunGoList(goExec string, cwd string) (*GoListCmd, error)

RunGoList ... Actual function that executes go list command and returns output as string.

func (*GoListCmd) ReadCloser

func (list *GoListCmd) ReadCloser() io.ReadCloser

ReadCloser implements internal.GoList

func (*GoListCmd) Wait

func (list *GoListCmd) Wait() error

Wait implements internal.GoList

type Manifest

type Manifest struct {
	Version  string       `json:"version"`
	Main     string       `json:"main"`
	Packages []Dependency `json:"packages"`
}

Manifest ... Final manifest file structure

func BuildManifest

func BuildManifest(depPackages *map[string]DepPackage) Manifest

BuildManifest ... Build direct & transitive dependencies.

func (Manifest) Write

func (manifest Manifest) Write(writer io.Writer) error

Save ... Save manifest object into a given save path.

Jump to

Keyboard shortcuts

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