Skip to content

Commit

Permalink
Fix mod up not working
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Jul 8, 2020
1 parent af7a360 commit e6f94d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
17 changes: 14 additions & 3 deletions pkg/releasetracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,12 @@ func (p *Tracker) extractObjects(tmp interface{}, objPath, verPath, metaKey stri

var rs []*Release

var ary []interface{}

switch typed := got.(type) {
case []interface{}:
ary = typed

for _, obj := range typed {
raw, err := jsonpath.Get(verPath, obj)
if err != nil {
Expand All @@ -512,19 +516,26 @@ func (p *Tracker) extractObjects(tmp interface{}, objPath, verPath, metaKey stri

v, err := p.parseVersion(s)
if err != nil {
return nil, err
p.Logger.Info("Ignoring error: parsing semver", "error", err.Error(), "value", s, "jsonPath", verPath)
continue
}

meta := map[string]interface{}{
metaKey: obj,
}

rs = append(rs, &Release{
Semver: v,
Semver: v,
Version: strings.TrimPrefix(s, "v"),
Meta: meta,
Meta: meta,
})
}
default:
return nil, fmt.Errorf("extracting json array at path %q: invalid type of value, %T, found", objPath, typed)
}

if len(rs) == 0 {
return nil, fmt.Errorf("no valid versions extracted out of %d items at path %q under array at %q", len(ary), verPath, objPath)
}

sort.Slice(rs, func(i, j int) bool {
Expand Down
9 changes: 8 additions & 1 deletion pkg/variantmod/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,14 @@ func (m *ModuleManager) loadLockFile(path string) (*confapi.State, error) {
}
}

lockContents := confapi.State{Dependencies: map[string]confapi.DependencyState{}, RawLock: string(bytes)}
lockContents := confapi.State{
Dependencies: map[string]confapi.DependencyState{},
Meta: confapi.StateMeta{
Dependencies: map[string]confapi.VersionedDependencyStateMeta{},
},
RawLock: string(bytes),
}

if bytes != nil {
m.Logger.V(2).Info("load.yaml.unmarshal.begin", "bytes", string(bytes))
if err := yaml.Unmarshal(bytes, &lockContents); err != nil {
Expand Down

0 comments on commit e6f94d9

Please sign in to comment.