Don't add unconstrained deps to Manifest on init. #585
Conversation
cmd/dep/init.go
Outdated
delete(m.Dependencies, pr) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's required. The vendor projects are also tracked in git. But I do see some changes in vendored project code in the PR, which could have appeared due to running some form of ensure. Are you sure you ran just |
cmd/dep/init.go
Outdated
// Find any solved dependencies that are unconstrained and remove them from | ||
// the manifest. | ||
for pr, d := range m.Dependencies { | ||
if d.Constraint == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to check if d.Source == ""
- we only consider a project empty/unconstrained if it has neither a version constraint, nor a special source location.
@darkowlzz, I'm not entirely sure thats all I ran. It could be because I messed up when I cloned it to |
@darkowlzz, Was able to remove those vendor changes just fine. On a different note, is it expected that this change would also change the lock file's memo? My guess is that It shouldn't change it since it is a hash of the lock files dependencies. |
@jonstacks yes, it's expected to change. Memo is calculated based on manifest and lock data. You can run I think a git hard reset to the current latest (with git clean, if required) would get rid of all the manifest, lock and vendor changes. And then you can switch to your feature branch (rebase if required) and continue working, provided you remove any manifest, lock and vendor changes form your old commits. :) |
I have made changes to make sure that if either the Constraint or Source exist then it will get added. Thanks to both you and @darkowlzz for helping me out. |
cmd/dep/init.go
Outdated
} else { | ||
if ctx.Loggers.Verbose { | ||
ctx.Loggers.Err.Printf("dep: \"%v\" is unconstrained. Not adding to project data.\n", pr) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logging is not required. We are trying to remove the existing "dep: ..."
logs at init because it makes the init output (verbose/non-verbose) confusing, combined with constraint feedback output.
The feedback()
following this code would handle displaying that it's a revision only project constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been removed.
LGTM - yay, first contributions! 🎉 🎉 |
Attempts to fix #574.
Ran
dep ensure
before I built this locally to get dependencies. It added all of the vendor files and not sure if they should be there.Also, I wasn't sure if this was better suited being moved into the gps package instead of just in the init.
Thanks,