Documentation ¶
Overview ¶
Package gosrc fetches Go package source code from version control services.
Index ¶
- Variables
- func GetGitHubUpdates(client *http.Client, pushedAfter string) (maxPushedAt string, names []string, err error)
- func IsGoRepoPath(path string) bool
- func IsNotFound(err error) bool
- func IsValidPath(importPath string) bool
- func IsValidRemotePath(importPath string) bool
- func OverwriteLineComments(p []byte)
- func SetLocalDevMode(path string)
- type Directory
- type File
- type NotFoundError
- type Presentation
- type Project
- type RemoteError
Constants ¶
This section is empty.
Variables ¶
var ErrNotModified = errors.New("package not modified")
ErrNotModified indicates that the directory matches the specified etag.
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 ¶
IsGoRepoPath returns true if path is in $GOROOT/src.
func IsNotFound ¶
IsNotFound returns true if err is of type NotFoundError.
func IsValidPath ¶
IsValidPath returns true if importPath is structurally valid.
func IsValidRemotePath ¶
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. Example: "%s#L%d" LineFmt string }
Directory describes a directory on a version control service.
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 ¶
func GetPresentation ¶
func GetPresentation(client *http.Client, importPath string) (*Presentation, error)
GetPresentation gets a presentation from the the given path.
type RemoteError ¶
type RemoteError struct { Host string // contains filtered or unexported fields }
func (*RemoteError) Error ¶
func (e *RemoteError) Error() string