indexwait

package module
v0.0.0-...-1a867ea Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 13 Imported by: 0

README

Build Status Coverage Status GoDoc Go Report Card

Overview

This tool is a workflow optimization for Go module development.

When you are pushing changes to one module and will then need to bump its revision in the dependencies of another module, you will typically need to wait between five and forty minutes for the Go Proxy to represent the change and for "go get -u" to then see it and be able to update dependencies with it.

The primary purpoe of this tool is to block until the version reported by the Index is equal to or newer than your local repository. This also works for private Proxy implementations/instances.

Usage

$ go run command/go-wait-for-index/main.go github.com/dsoprea/go-exif
$

Get more information by printing verbosity:

$ go run command/go-wait-for-index/main.go -v github.com/dsoprea/go-exif
2020/05/24 02:15:56 main.main: [DEBUG]  Package path: [/home/doprea/development/go/src/github.com/dsoprea/go-exif]
2020/05/24 02:15:56 main.main: [DEBUG]  Current commit: REVISION=[1a12aec48f9023351e9c08b9bb7dd381e47233e9] TIMESTAMP=[2020-05-20 15:12:04 -0400 -0400]
2020/05/24 02:15:57 main.main: [INFO]  Index matches local revision: INDEX=[1a12aec48f90] LOCAL=[1a12aec48f9023351e9c08b9bb7dd381e47233e9]
2020/05/24 02:15:57 main.main: [DEBUG]  Wait time: [281.851456ms]

See the command-line help for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedModuleInfo

type CachedModuleInfo struct {
	VersionPhrase ModuleVersionPhrase `json:"Version"`
	Timestamp     time.Time           `json:"Time"`
}

CachedModuleInfo is the information currently advertised for a module.

func (CachedModuleInfo) DumpFields

func (cmi CachedModuleInfo) DumpFields()

DumpFields prints the current values of the fields.

func (CachedModuleInfo) String

func (cmi CachedModuleInfo) String() string

String returns a descriptive string.

type Git

type Git struct {
}

Git provides a VCS implementation for Git.

func (*Git) GetHeadCommit

func (*Git) GetHeadCommit(packagePath string) (revision string, timestamp time.Time, err error)

GetHeadCommit returns the current revision of the package/module.

func (*Git) Name

func (*Git) Name() string

Name returns the name of the VCS method.

type ModuleVersion

type ModuleVersion struct {
	// Version is the currently advertised module version.
	Version string

	// Timestamp is the currently advertised committer timestamp.
	Timestamp time.Time

	// RevisionPrefix is the currently advertised revision (just a prefix of the
	// revision, actually).
	RevisionPrefix string
}

ModuleVersion describes the components of the reported version.

func NewModuleVersionFromRaw

func NewModuleVersionFromRaw(versionPhrase ModuleVersionPhrase) (mv ModuleVersion, err error)

NewModuleVersionFromRaw returns a ModuleVersion instance from the raw phrase.

func (ModuleVersion) DumpFields

func (mv ModuleVersion) DumpFields()

DumpFields prints the current values of the fields.

func (ModuleVersion) InnerString

func (mv ModuleVersion) InnerString() string

InnerString returns a string that can be embedded in another.

func (ModuleVersion) String

func (mv ModuleVersion) String() string

String returns a complete string for printing.

type ModuleVersionPhrase

type ModuleVersionPhrase string

ModuleVersionPhrase is a string that knows how to parse itself into components.

func (ModuleVersionPhrase) Parse

func (mvp ModuleVersionPhrase) Parse() (mv ModuleVersion, err error)

Parse parses the raw module-version string and returns a ModuleVersion.

type Package

type Package struct {
}

Package manages project package information.

func (Package) GetPackagePath

func (Package) GetPackagePath(packageName string) (packagePath, vcsName string, err error)

GetPackagePath returns the giben package's

type ProxyClient

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

ProxyClient knows how to hit the globalpublic Go Proxy endpoint.

func NewProxyClient

func NewProxyClient(url string) *ProxyClient

NewProxyClient returns a new ProxyClient struct.

func (*ProxyClient) FetchModuleInfo

func (pc *ProxyClient) FetchModuleInfo(packageName string) (cmi CachedModuleInfo, err error)

FetchModuleInfo returns the current published version of the module.

type Vcs

type Vcs interface {
	// Name returns the name of the VCS method. Must be in the family of names
	// returned by go-git (though it will be compared case-insensitively).
	Name() string

	// GetHeadCommit returns the current revision of the packaging/module.
	GetHeadCommit(packagePath string) (revision string, timestamp time.Time, err error)
}

Vcs describes an interface that knows how to reads version-control from a package.

func GetVcs

func GetVcs(name string) (vcs Vcs, found bool)

GetVcs returns a version-control accessor given a name for one.

Directories

Path Synopsis
command
go-wait-for-index
Package main looks up the given repository's branch's HEAD revision and then queries the default global Go Proxy for that module in a loop until it reports the latest revision.
Package main looks up the given repository's branch's HEAD revision and then queries the default global Go Proxy for that module in a loop until it reports the latest revision.

Jump to

Keyboard shortcuts

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