1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: update repo to use the new error handling syntax (#8950)

This commit is contained in:
spaceface
2021-02-28 21:20:21 +01:00
committed by GitHub
parent b9a381f101
commit d63b7bc35a
135 changed files with 487 additions and 468 deletions

View File

@@ -175,7 +175,7 @@ fn (foptions &FormatOptions) format_file(file string) {
file_name := os.file_name(file)
ulid := rand.ulid()
vfmt_output_path := os.join_path(vtmp_folder, 'vfmt_${ulid}_$file_name')
os.write_file(vfmt_output_path, formatted_content) or { panic(err) }
os.write_file(vfmt_output_path, formatted_content) or { panic(err.msg) }
if foptions.is_verbose {
eprintln('fmt.fmt worked and $formatted_content.len bytes were written to $vfmt_output_path .')
}
@@ -266,7 +266,7 @@ fn (foptions &FormatOptions) post_process_file(file string, formatted_file_path
}
if foptions.is_w {
if is_formatted_different {
os.mv_by_cp(formatted_file_path, file) or { panic(err) }
os.mv_by_cp(formatted_file_path, file) or { panic(err.msg) }
eprintln('Reformatted file: $file')
} else {
eprintln('Already formatted file: $file')
@@ -312,7 +312,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
pfolder := os.real_path(os.dir(file))
// a .v project has many 'module main' files in one folder
// if there is only one .v file, then it must be a standalone
all_files_in_pfolder := os.ls(pfolder) or { panic(err) }
all_files_in_pfolder := os.ls(pfolder) or { panic(err.msg) }
mut vfiles := []string{}
for f in all_files_in_pfolder {
vf := os.join_path(pfolder, f)
@@ -332,7 +332,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
// a project folder, that should be compiled with `v pfolder`.
mut main_fns := 0
for f in vfiles {
slines := read_source_lines(f) or { panic(err) }
slines := read_source_lines(f) or { panic(err.msg) }
for line in slines {
if line.contains('fn main()') {
main_fns++