mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vpm: stop and output an error message after parsing the v.mod file failed (#15994)
This commit is contained in:
parent
267cd5569a
commit
4eeb45b94e
@ -301,7 +301,10 @@ fn vpm_install_from_vcs(module_names []string, vcs_key string) {
|
|||||||
vmod_path := os.join_path(final_module_path, 'v.mod')
|
vmod_path := os.join_path(final_module_path, 'v.mod')
|
||||||
if os.exists(vmod_path) {
|
if os.exists(vmod_path) {
|
||||||
data := os.read_file(vmod_path) or { return }
|
data := os.read_file(vmod_path) or { return }
|
||||||
vmod := parse_vmod(data)
|
vmod := parse_vmod(data) or {
|
||||||
|
eprintln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
minfo := mod_name_info(vmod.name)
|
minfo := mod_name_info(vmod.name)
|
||||||
println('Relocating module from "$name" to "$vmod.name" ( "$minfo.final_module_path" ) ...')
|
println('Relocating module from "$name" to "$vmod.name" ( "$minfo.final_module_path" ) ...')
|
||||||
if os.exists(minfo.final_module_path) {
|
if os.exists(minfo.final_module_path) {
|
||||||
@ -641,7 +644,10 @@ fn resolve_dependencies(name string, module_path string, module_names []string)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
data := os.read_file(vmod_path) or { return }
|
data := os.read_file(vmod_path) or { return }
|
||||||
vmod := parse_vmod(data)
|
vmod := parse_vmod(data) or {
|
||||||
|
eprintln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
mut deps := []string{}
|
mut deps := []string{}
|
||||||
// filter out dependencies that were already specified by the user
|
// filter out dependencies that were already specified by the user
|
||||||
for d in vmod.deps {
|
for d in vmod.deps {
|
||||||
@ -656,8 +662,8 @@ fn resolve_dependencies(name string, module_path string, module_names []string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_vmod(data string) Vmod {
|
fn parse_vmod(data string) !Vmod {
|
||||||
manifest := vmod.decode(data) or { vmod.Manifest{} }
|
manifest := vmod.decode(data) or { return error('Parsing v.mod file failed, $err') }
|
||||||
mut vmod := Vmod{}
|
mut vmod := Vmod{}
|
||||||
vmod.name = manifest.name
|
vmod.name = manifest.name
|
||||||
vmod.version = manifest.version
|
vmod.version = manifest.version
|
||||||
|
Loading…
Reference in New Issue
Block a user