Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

gps: improve documentation; add package doc #1619

Merged
merged 1 commit into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ So, given a slice of the following versions:
- Non-semver tags: `footag`
- Revision: `f6e74e8d`

Sorting for upgrade will result in the following slice.
Sorting for upgrade will result in the following slice:

`[v1.1.0 v1.0.0 v1.1.0-alpha1 master devel footag f6e74e8d]`

Expand Down
10 changes: 1 addition & 9 deletions gps/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
// sourceBridge is an adapter to SourceManagers that tailor operations for a
// single solve run.
type sourceBridge interface {
// sourceBridge includes all the methods in the SourceManager interface except
// for Release().
// sourceBridge includes many methods from the SourceManager interface.
SourceExists(ProjectIdentifier) (bool, error)
SyncSourceFor(ProjectIdentifier) error
RevisionPresentIn(ProjectIdentifier, Revision) (bool, error)
Expand All @@ -26,14 +25,7 @@ type sourceBridge interface {
ExportProject(ProjectIdentifier, Version, string) error
DeduceProjectRoot(ip string) (ProjectRoot, error)

//sourceExists(ProjectIdentifier) (bool, error)
//syncSourceFor(ProjectIdentifier) error
listVersions(ProjectIdentifier) ([]Version, error)
//revisionPresentIn(ProjectIdentifier, Revision) (bool, error)
//listPackages(ProjectIdentifier, Version) (pkgtree.PackageTree, error)
//getManifestAndLock(ProjectIdentifier, Version, ProjectAnalyzer) (Manifest, Lock, error)
//exportProject(ProjectIdentifier, Version, string) error
//deduceProjectRoot(ip string) (ProjectRoot, error)
verifyRootDir(path string) error
vendorCodeExists(ProjectIdentifier) (bool, error)
breakLock()
Expand Down
6 changes: 6 additions & 0 deletions gps/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package gps is a Go packaging solver library.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embedding code examples here could get pretty dense, but maybe this should point to example.go at least (especially since it doesn't show up in the go doc as a runnable example).

package gps
4 changes: 2 additions & 2 deletions gps/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type Lock interface {
}

// LocksAreEq checks if two locks are equivalent. This checks that
// all contained LockedProjects are equal, and optionally (if the third
// parameter is true) whether the locks' input hashes are equal.
// all contained LockedProjects are equal, and optionally (if `checkHash` is
// true) whether the locks' input hashes are equal.
func LocksAreEq(l1, l2 Lock, checkHash bool) bool {
// Cheapest ops first
if checkHash && !bytes.Equal(l1.InputsDigest(), l2.InputsDigest()) {
Expand Down
2 changes: 1 addition & 1 deletion gps/lockdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func buildLockedProjectDiff(lp LockedProject) LockedProjectDiff {
}

// DiffProjects compares two projects and identifies the differences between them.
// Returns nil if there are no differences
// Returns nil if there are no differences.
func DiffProjects(lp1 LockedProject, lp2 LockedProject) *LockedProjectDiff {
diff := LockedProjectDiff{Name: lp1.pi.ProjectRoot}

Expand Down
16 changes: 8 additions & 8 deletions gps/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// semantics beyond that which is literally embedded on the Go type.
type VersionType uint8

// VersionTypes for the four major classes of version we deal with
// VersionTypes for the four major classes of version.
const (
IsRevision VersionType = iota
IsVersion
Expand All @@ -39,7 +39,7 @@ const (
type Version interface {
Constraint

// Indicates the type of version - Revision, Branch, Version, or Semver
// Indicates the type of version - Revision, Branch, Version, or Semver.
Type() VersionType
}

Expand All @@ -53,11 +53,11 @@ type PairedVersion interface {

// Unpair returns the surface-level UnpairedVersion that half of the pair.
//
// It does NOT modify the original PairedVersion
// It does NOT modify the original PairedVersion.
Unpair() UnpairedVersion

// Ensures it is impossible to be both a PairedVersion and an
// UnpairedVersion
// UnpairedVersion.
_pair(int)
}

Expand All @@ -69,7 +69,7 @@ type UnpairedVersion interface {
// to and unites them into a PairedVersion.
Pair(Revision) PairedVersion
// Ensures it is impossible to be both a PairedVersion and an
// UnpairedVersion
// UnpairedVersion.
_pair(bool)
}

Expand Down Expand Up @@ -693,7 +693,7 @@ func compareVersionType(l, r Version) int {
// - Non-semver tags: footag
// - Revision: f6e74e8d
//
// Sorting for upgrade will result in the following slice.
// Sorting for upgrade will result in the following slice:
//
// [v1.1.0 v1.0.0 v1.1.0-alpha1 master devel footag f6e74e8d]
func SortForUpgrade(vl []Version) {
Expand Down Expand Up @@ -726,7 +726,7 @@ func SortPairedForUpgrade(vl []PairedVersion) {
// - Non-semver tags: footag
// - Revision: f6e74e8d
//
// Sorting for downgrade will result in the following slice.
// Sorting for downgrade will result in the following slice:
//
// [v1.0.0 v1.1.0 v1.1.0-alpha1 footag devel master f6e74e8d]
func SortForDowngrade(vl []Version) {
Expand Down Expand Up @@ -854,7 +854,7 @@ func hidePair(pvl []PairedVersion) []Version {
return vl
}

// VersionComponentStrings decomposes a Version into the underlying number, branch and revision
// VersionComponentStrings decomposes a Version into the underlying number, branch and revision.
func VersionComponentStrings(v Version) (revision string, branch string, version string) {
switch tv := v.(type) {
case UnpairedVersion:
Expand Down