Skip to content

Commit 5d824ad

Browse files
author
sam boyer
committed
Reverse args order to lid()
1 parent 7124f98 commit 5d824ad

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

bind.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type lensID struct {
5454
From, To SyntacticVersion
5555
}
5656

57-
func lid(to, from SyntacticVersion) lensID {
57+
func lid(from, to SyntacticVersion) lensID {
5858
return lensID{from, to}
5959
}
6060

@@ -218,7 +218,7 @@ func (ml *maybeLineage) checkGoLensCompleteness() error {
218218
// TODO(sdboyer) it'd be nice to consolidate all the errors so that the user always sees a complete set of problems
219219
all := make(map[lensID]bool)
220220
for _, lens := range ml.implens {
221-
id := lid(lens.To, lens.From)
221+
id := lid(lens.From, lens.To)
222222
if all[id] {
223223
return fmt.Errorf("duplicate Go migration %s", id)
224224
}
@@ -234,7 +234,7 @@ func (ml *maybeLineage) checkGoLensCompleteness() error {
234234
for _, sch := range ml.schlist[1:] {
235235
// there must always at least be a reverse lens
236236
v := sch.Version()
237-
revid := lid(prior, v)
237+
revid := lid(v, prior)
238238

239239
if !all[revid] {
240240
missing = append(missing, revid)
@@ -244,7 +244,7 @@ func (ml *maybeLineage) checkGoLensCompleteness() error {
244244

245245
if v[0] != prior[0] {
246246
// if we crossed a major version, there must also be a forward lens
247-
fwdid := lid(v, prior)
247+
fwdid := lid(prior, v)
248248
if !all[fwdid] {
249249
missing = append(missing, fwdid)
250250
} else {
@@ -272,7 +272,7 @@ func (ml *maybeLineage) checkGoLensCompleteness() error {
272272
// walk the slice so output is reliably ordered
273273
for _, lens := range ml.implens {
274274
// if it's not in the list it's because it was expected & already processed
275-
elid := lid(lens.To, lens.From)
275+
elid := lid(lens.From, lens.To)
276276
if _, has := all[elid]; !has {
277277
continue
278278
}
@@ -301,7 +301,7 @@ func (ml *maybeLineage) checkGoLensCompleteness() error {
301301

302302
ml.lensmap = make(map[lensID]ImperativeLens, len(ml.implens))
303303
for _, lens := range ml.implens {
304-
ml.lensmap[lid(lens.To, lens.From)] = lens
304+
ml.lensmap[lid(lens.From, lens.To)] = lens
305305
}
306306

307307
return nil

instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func (i *Instance) translateGo(to SyntacticVersion) (*Instance, TranslationLacun
276276
var err error
277277
if to.Less(from) || sch.Version()[0] != nsch.Version()[0] {
278278
// Going backward, or crossing major version - need explicit lens
279-
mlid := lid(nsch.Version(), sch.Version())
279+
mlid := lid(sch.Version(), nsch.Version())
280280
rti, err = lensmap[mlid].Mapper(ti, nsch)
281281
if err != nil {
282282
return nil, nil, fmt.Errorf("error executing %s migration: %w", mlid, err)

0 commit comments

Comments
 (0)