зеркало из https://github.com/golang/dep.git
gps: Fix up odds and ends around IgnoreRulesets
The most crucial piece is fixing the hasher to make its prefix checks without the wildcard suffix for the purpose of determining whether the ignore affects the root project; otherwise, wildcards on the root of the current project (why would you do this?) would be erroneously included in hash inputs.
This commit is contained in:
Родитель
b0face73a0
Коммит
c20530499e
|
@ -85,7 +85,10 @@ func (s *solver) writeHashingInputs(w io.Writer) {
|
|||
ig := s.rd.ir.ToSlice()
|
||||
sort.Strings(ig)
|
||||
for _, igp := range ig {
|
||||
if !strings.HasPrefix(igp, s.rd.rpt.ImportRoot) || !isPathPrefixOrEqual(s.rd.rpt.ImportRoot, igp) {
|
||||
// Typical prefix comparison checks will erroneously fail if the wildcard
|
||||
// is present. Trim it off, if present.
|
||||
tigp := strings.TrimSuffix(igp, "*")
|
||||
if !strings.HasPrefix(tigp, s.rd.rpt.ImportRoot) || !isPathPrefixOrEqual(s.rd.rpt.ImportRoot, tigp) {
|
||||
writeString(igp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,6 @@ type rootdata struct {
|
|||
// Ruleset for ignored import paths.
|
||||
ir *pkgtree.IgnoredRuleset
|
||||
|
||||
// Map of packages to ignore.
|
||||
ig map[string]bool
|
||||
|
||||
// Radix tree of ignore prefixes.
|
||||
igpfx *radix.Tree
|
||||
|
||||
// Map of packages to require.
|
||||
req map[string]bool
|
||||
|
||||
|
|
|
@ -195,10 +195,7 @@ func (params SolveParameters) toRootdata() (rootdata, error) {
|
|||
an: params.ProjectAnalyzer,
|
||||
}
|
||||
|
||||
// Ensure the required, ignore and overrides maps are at least initialized
|
||||
if rd.ig == nil {
|
||||
rd.ig = make(map[string]bool)
|
||||
}
|
||||
// Ensure the required and overrides maps are at least initialized
|
||||
if rd.req == nil {
|
||||
rd.req = make(map[string]bool)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче