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

Split input components out in Gopkg.lock #584

Merged
merged 5 commits into from
May 27, 2017

Conversation

sdboyer
Copy link
Member

@sdboyer sdboyer commented May 16, 2017

Fixes #508
Fixes #421

The essential changes are as follows:

  • Lock now has a Lock.Inputs that contains the three bits of input info we want to track (for now): the old top-level Memo property, plus the name and version of the analyzer.
  • gps.Solution adds two methods to return the name and version of the ProjectAnalyzer that was used to create the solution.
  • LockFromInterface(in gps.Lock) *Lock becomes LockFromSolution(in gps.Solution) *Lock.

@sdboyer
Copy link
Member Author

sdboyer commented May 22, 2017

This now fixes #421, as well.

@@ -162,7 +162,7 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error {
writeV = dep.VendorAlways
}

newLock := dep.LockFromInterface(solution)
newLock := dep.LockFromSolution(solution)
Copy link
Collaborator

Choose a reason for hiding this comment

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

🎉 I know this is a small change, but the name is so much more clear that this gave me a happy.

}

func (s *solver) Name() string {
return "gps-cdcl"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does cdcl mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

Conflict-Driven Clause Learning. It's the general class of SAT solver into which gps' solver falls.

@@ -2,6 +2,7 @@
"commands": [
["remove", "github.com/not/used"]
],
"error-expected": "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 I've been seeing this pop up when I run tests locally. Any idea why the build didn't break and force us to update the testdata when it was first introduced?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've noticed it elsewhere, as well. I assume the build doesn't break because we're not actually validating that file - it's just the testcase procedure. What actually strikes me as odd is that passing the -update flag writes these files out at all. That seems like the actual mistake bug.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh right, we only compare golden files, not the testcases. I don't think it's a bug to update testcase files when -update is specified, e.g. updating the final vendor contents or expected-error message. It just looks odd in this instance because it's not fixing the test, and is just futzing with the schema/formatting.

// The version of the ProjectAnalyzer used in generating this solution.
AnalyzerVersion() int
// The name of the Solver used in generating this solution.
SolverName() string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like there's a plan for having multiple solvers in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no actual plan to do so, but it's possible that circumstances could demand it. We definitely needed the solver version field; as long as I was adding one, it seemed only to make sense to add the other.

Also...I wanted to make the cdcl thing explicit, because people would ask questions. Like you did. And then maybe get interested in working on the solver 😄

lock.go Outdated
}

type solveMeta struct {
Memo string `toml:"inputs-hash"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you feel about renaming Memo to InputsHash? Small nit but would make it easier on contributors if the names lined up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I kinda flip-flopped on this. There are a bunch of different similar names that get used for this - both the method that does it, and the name of fields that store it. (This mirrors the common conflation of "hashing" with "hash digest"). I didn't change it only because I kinda didn't want to start unpacking that can of worms...though still, yes, it would be incrementally better to change it here now and then change it again later than have the incongruity.

@@ -1,4 +1,5 @@
memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
[solve-meta]
inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit, but can we indent this consistently with the rest of the file?

@@ -1,5 +1,3 @@
Memo: 595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c -> 2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is going to be cleaned up in #623, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah crap, I think I just plain did this part wrong. Thanks for catching it.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is, if there was a memo diff before, there should be a memo diff now.

@sdboyer
Copy link
Member Author

sdboyer commented May 23, 2017

this is integrated in the stabilize-files branch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants