Skip to content
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

Don't tell people to use Pkg to install Pkg #53197

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1885,10 +1885,14 @@ function __require(into::Module, mod::Symbol)
end
end
hint_message = hint ? ", maybe you meant `import/using $(dots)$(mod)`" : ""
start_sentence = hint ? "Otherwise, run" : "Run"
throw(ArgumentError("""
Package $mod not found in current path$hint_message.
- $start_sentence `import Pkg; Pkg.add($(repr(String(mod))))` to install the $mod package."""))
install_message = if mod != :Pkg
start_sentence = hint ? "Otherwise, run" : "Run"
"\n- $start_sentence `import Pkg; Pkg.add($(repr(String(mod))))` to install the $mod package."
else # for some reason Pkg itself isn't availability so do not tell them to use Pkg to install it.
""
end

throw(ArgumentError("Package $mod not found in current path$hint_message.$install_message"))
else
manifest_warnings = collect_manifest_warnings()
throw(ArgumentError("""
Expand Down