-
-
Notifications
You must be signed in to change notification settings - Fork 893
gleam update should return error if package does not exists #5171
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
base: main
Are you sure you want to change the base?
gleam update should return error if package does not exists #5171
Conversation
lpil
left a comment
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.
Looks good, thank you!
Mm yes it's tricky, this bit of the codebase isn't very testable. What you've suggested sounds good to me.
compiler-core/src/error.rs
Outdated
| RemovedPackagesNotExist { packages: Vec<String> }, | ||
|
|
||
| #[error("Packages to update not exist: {}", packages.iter().join(", "))] | ||
| PackagesToUpdateNotExist { packages: Vec<String> }, |
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.
Use the eco string type please
| fn ensure_packages_exist_locally( | ||
| &self, | ||
| manifest: &Manifest, | ||
| packages: Vec<EcoString>, |
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.
Take this by reference please 🙏
| packages: Vec<EcoString>, | |
| packages: &[EcoString], |
| } | ||
|
|
||
| fn ensure_packages_exist_locally( | ||
| &self, |
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.
Doesn't look like self is used, so this should be a module function rather than a method on this struct.
150a5ab to
017d5e2
Compare
5f977fa to
c09dd5e
Compare
c09dd5e to
5ecddc2
Compare
Fixes #4836.
Continuation of #4887.
The only question is that I don't know how to test ensure_packages_exist_locally. Should I extract it to a standalone function outside of the impl block?