gosrc

package
v0.0.0-...-a9487c4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 24 Imported by: 0

README

Package gosrc fetches Go package source code from version control services.

Contributions

Contributions to this project are welcome, though please send mail before starting work on anything major. Contributors retain their copyright, so we need you to fill out a short form before we can accept your contribution: https://developers.google.com/open-source/cla/individual

Documentation

Overview

Package gosrc fetches Go package source code from version control services.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotModified = errors.New("package not modified")

ErrNotModified indicates that the directory matches the specified etag.

View Source
var TempDir = filepath.Join(os.TempDir(), "gddo")

Store temporary data in this directory.

Functions

func GetGitHubUpdates

func GetGitHubUpdates(client *http.Client, pushedAfter string) (maxPushedAt string, names []string, err error)

GetGitHubUpdates returns the full names ("owner/repo") of recently pushed GitHub repositories. by pushedAfter.

func IsGoRepoPath

func IsGoRepoPath(path string) bool

IsGoRepoPath returns true if path is in $GOROOT/src.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if err is of type NotFoundError.

func IsValidPath

func IsValidPath(importPath string) bool

IsValidPath returns true if importPath is structurally valid.

func IsValidRemotePath

func IsValidRemotePath(importPath string) bool

IsValidRemotePath returns true if importPath is structurally valid for "go get".

func OverwriteLineComments

func OverwriteLineComments(p []byte)

func SetLocalDevMode

func SetLocalDevMode(path string)

SetLocalDevMode sets the package to local development mode. In this mode, the GOPATH specified by path is used to find directories instead of version control services.

Types

type Directory

type Directory struct {
	// The import path for this package.
	ImportPath string

	// Import path of package after resolving go-import meta tags, if any.
	ResolvedPath string

	// Import path prefix for all packages in the project.
	ProjectRoot string

	// Name of the project.
	ProjectName string

	// Project home page.
	ProjectURL string

	// Version control system: git, hg, bzr, ...
	VCS string

	// Version control: belongs to a dead end fork
	DeadEndFork bool

	// Cache validation tag. This tag is not necessarily an HTTP entity tag.
	// The tag is "" if there is no meaningful cache validation for the VCS.
	Etag string

	// Files.
	Files []*File

	// Subdirectories, not guaranteed to contain Go code.
	Subdirectories []string

	// Location of directory on version control service website.
	BrowseURL string

	// Format specifier for link to source line. It must contain one %s (file URL)
	// followed by one %d (source line number), or be empty string if not available.
	// Example: "%s#L%d".
	LineFmt string
}

Directory describes a directory on a version control service.

func Get

func Get(client *http.Client, importPath string, etag string) (dir *Directory, err error)

func (*Directory) Import

func (dir *Directory) Import(ctx *build.Context, mode build.ImportMode) (*build.Package, error)

Import returns details about the package in the directory.

type File

type File struct {
	// File name with no directory.
	Name string

	// Contents of the file.
	Data []byte

	// Location of file on version control service website.
	BrowseURL string
}

File represents a file.

type NotFoundError

type NotFoundError struct {
	// Diagnostic message describing why the directory was not found.
	Message string

	// Redirect specifies the path where package can be found.
	Redirect string
}

NotFoundError indicates that the directory or presentation was not found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Presentation

type Presentation struct {
	Filename string
	Files    map[string][]byte
	Updated  time.Time
}

func GetPresentation

func GetPresentation(client *http.Client, importPath string) (*Presentation, error)

GetPresentation gets a presentation from the the given path.

type Project

type Project struct {
	Description string
}

Project represents a repository.

func GetProject

func GetProject(client *http.Client, importPath string) (*Project, error)

GetProject gets information about a repository.

type RemoteError

type RemoteError struct {
	Host string
	// contains filtered or unexported fields
}

func (*RemoteError) Error

func (e *RemoteError) Error() string

Jump to

Keyboard shortcuts

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