Skip to content

Commit

Permalink
fix(E2009): outputs both sheet names for both workbooks if key is dup…
Browse files Browse the repository at this point in the history
…licated (#168)

* fix(E2009): outputs both sheet names for both workbooks when duplicated

* fix: other errors
  • Loading branch information
Kybxd authored Dec 4, 2024
1 parent 59bc915 commit 2efbff9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/confgen/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ func (x *sheetExporter) MergeAndExport(info *SheetInfo,
}

type oneMsg struct {
protomsg proto.Message
bookName string
protomsg proto.Message
bookName string
sheetName string
}

// ParseMessage parses multiple importer infos into one protomsg. If an error
Expand Down Expand Up @@ -160,8 +161,9 @@ func ParseMessage(info *SheetInfo, impInfos ...importer.ImporterInfo) (proto.Mes
}
mu.Lock()
msgs = append(msgs, oneMsg{
protomsg: protomsg,
bookName: getRelBookName(info.ExtInfo.InputDir, impInfo.Filename()),
protomsg: protomsg,
bookName: getRelBookName(info.ExtInfo.InputDir, impInfo.Filename()),
sheetName: getRealSheetName(info, impInfo),
})
mu.Unlock()
return nil
Expand All @@ -187,18 +189,19 @@ func ParseMessage(info *SheetInfo, impInfos ...importer.ImporterInfo) (proto.Mes
err := xproto.CheckMapDuplicateKey(prevMsg.protomsg, msg.protomsg)
if err != nil {
bookNames := prevMsg.bookName + ", " + msg.bookName
sheetNames := prevMsg.sheetName + ", " + msg.sheetName
return nil, xerrors.WrapKV(err,
xerrors.KeyModule, xerrors.ModuleConf,
xerrors.KeyBookName, bookNames,
xerrors.KeySheetName, info.Opts.Name,
xerrors.KeySheetName, sheetNames,
xerrors.KeyPBMessage, string(info.MD.Name()))
}
}
}
return nil, xerrors.WrapKV(err,
xerrors.KeyModule, xerrors.ModuleConf,
xerrors.KeyBookName, msg.bookName,
xerrors.KeySheetName, info.Opts.Name,
xerrors.KeySheetName, msg.sheetName,
xerrors.KeyPBMessage, string(info.MD.Name()))
}
}
Expand Down

0 comments on commit 2efbff9

Please sign in to comment.