Skip to content

Commit

Permalink
Don't tell people to use Pkg to install Pkg (#53197)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Feb 6, 2024
1 parent 28db6c7 commit 353884c
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 353884c

Please sign in to comment.