-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] kpm fixes the order of dependencies and format in kcl.mod and kcl.mod.lock #336
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,7 @@ func (kclPkg *KclPkg) LocalVendorPath() string { | |
// updateModAndLockFile will update kcl.mod and kcl.mod.lock | ||
func (kclPkg *KclPkg) UpdateModAndLockFile() error { | ||
// Generate file kcl.mod. | ||
kclPkg.ModFile.Dependencies.SortMapByKey() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @officialasishkumar 😃 Good job ! But I have a few different ideas about this feature. The go community maybe have libraries to help us solve this problem. Try to research some of the libraries and see the possible problems with using them. You can update the results of the research in the issue. I found a third-party library, https://github.com/elliotchance/orderedmap, but when the library is serialized into a It's not that your method is wrong, it's just that we need some evidence to show that this method is more appropriate than other methods. |
||
err := kclPkg.ModFile.StoreModFile() | ||
if err != nil { | ||
return err | ||
|
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 think we should use an ordered dictionary for serialization/deserialization instead of simply sorting, as KCL users often do not want unexpected changes to occur.
Besides,
[dependencies]
section and[profile]
section lost the expect newline.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.
Hey @Peefy , i've done some changes at #334, please have a look over them if they are in the right direction.
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.
@d4v1d03 OK. But we should avoid commenting on irrelevant PRs.