Remove detritus, unexport some things

This commit is contained in:
Sam Boyer 2016-03-17 12:45:36 -04:00
Родитель d029e0b0aa
Коммит bdd3e88655
6 изменённых файлов: 23 добавлений и 28 удалений

Просмотреть файл

@ -193,9 +193,9 @@ func (sm *depspecSourceManager) GetProjectInfo(id ProjectID) (ProjectInfo, error
for _, ds := range sm.specs {
if id.ID == ds.id.ID && id.Version.Info == ds.id.Version.Info {
return ProjectInfo{
pi: ds.id,
Spec: ds,
Lock: dummyLock{},
pi: ds.id,
Manifest: ds,
Lock: dummyLock{},
}, nil
}
}
@ -229,7 +229,7 @@ func (sm *depspecSourceManager) ProjectExists(id ProjectIdentifier) bool {
}
// enforce interfaces
var _ Spec = depspec{}
var _ Manifest = depspec{}
var _ Lock = dummyLock{}
// impl Spec interface

Просмотреть файл

@ -29,12 +29,6 @@ var VTCTCompat = [...]ConstraintType{
C_Semver | C_SemverRange,
}
type InfoLevel uint
const (
FromCache InfoLevel = 1 << iota
)
// ProjectExistence values represent the extent to which a project "exists."
type ProjectExistence uint8

Просмотреть файл

@ -5,6 +5,7 @@ import "testing"
func TestBasicSolves(t *testing.T) {
solveAndBasicChecks(0, t)
solveAndBasicChecks(1, t)
solveAndBasicChecks(2, t)
}
func solveAndBasicChecks(fixnum int, t *testing.T) Result {

Просмотреть файл

@ -5,13 +5,13 @@ import (
"fmt"
)
type SolveFailure uint
//type SolveFailure uint
const (
// Indicates that no version solution could be found
NoVersionSolution SolveFailure = 1 << iota
IncompatibleVersionType
)
//const (
// Indicates that no version solution could be found
//NoVersionSolution SolveFailure = 1 << iota
//IncompatibleVersionType
//)
func NewSolver(sm SourceManager) Solver {
return &solver{
@ -25,7 +25,7 @@ type solver struct {
latest map[ProjectIdentifier]struct{}
sel *selection
unsel *unselected
versions []*VersionQueue
versions []*versionQueue
rp ProjectInfo
attempts int
}
@ -91,10 +91,10 @@ func (s *solver) solve() ([]ProjectID, error) {
return projs, nil
}
func (s *solver) createVersionQueue(ref ProjectIdentifier) (*VersionQueue, error) {
func (s *solver) createVersionQueue(ref ProjectIdentifier) (*versionQueue, error) {
// If on the root package, there's no queue to make
if ref == s.rp.ID() {
return NewVersionQueue(ref, nil, s.sm)
return newVersionQueue(ref, nil, s.sm)
}
if !s.sm.ProjectExists(ref) {
@ -104,7 +104,7 @@ func (s *solver) createVersionQueue(ref ProjectIdentifier) (*VersionQueue, error
}
lockv := s.getLockVersionIfValid(ref)
q, err := NewVersionQueue(ref, lockv, s.sm)
q, err := newVersionQueue(ref, lockv, s.sm)
if err != nil {
// TODO this particular err case needs to be improved to be ONLY for cases
// where there's absolutely nothing findable about a given project name
@ -116,7 +116,7 @@ func (s *solver) createVersionQueue(ref ProjectIdentifier) (*VersionQueue, error
// findValidVersion walks through a VersionQueue until it finds a version that's
// valid, as adjudged by the current constraints.
func (s *solver) findValidVersion(q *VersionQueue) error {
func (s *solver) findValidVersion(q *versionQueue) error {
var err error
if q.current() == emptyPID {
// TODO this case shouldn't be reachable, but panic here as a canary

Просмотреть файл

@ -27,11 +27,11 @@ type Dependency struct {
// ProjectInfo holds the spec and lock information for a given ProjectID
type ProjectInfo struct {
pi ProjectID
Spec
Manifest
Lock
}
type Spec interface {
type Manifest interface {
ID() ProjectIdentifier
GetDependencies() []ProjectDep
GetDevDependencies() []ProjectDep

Просмотреть файл

@ -1,6 +1,6 @@
package vsolver
type VersionQueue struct {
type versionQueue struct {
ref ProjectIdentifier
pi []ProjectID
failed bool
@ -8,8 +8,8 @@ type VersionQueue struct {
sm SourceManager
}
func NewVersionQueue(ref ProjectIdentifier, lockv *ProjectID, sm SourceManager) (*VersionQueue, error) {
vq := &VersionQueue{
func newVersionQueue(ref ProjectIdentifier, lockv *ProjectID, sm SourceManager) (*versionQueue, error) {
vq := &versionQueue{
ref: ref,
sm: sm,
}
@ -32,7 +32,7 @@ func NewVersionQueue(ref ProjectIdentifier, lockv *ProjectID, sm SourceManager)
return vq, nil
}
func (vq *VersionQueue) current() ProjectID {
func (vq *versionQueue) current() ProjectID {
if len(vq.pi) > 0 {
return vq.pi[0]
}
@ -40,7 +40,7 @@ func (vq *VersionQueue) current() ProjectID {
return ProjectID{}
}
func (vq *VersionQueue) advance() (err error) {
func (vq *versionQueue) advance() (err error) {
// The current version may have failed, but the next one hasn't
vq.failed = false