mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: clean up file functions, use optionals
This commit is contained in:
@ -32,6 +32,7 @@ fn new_scanner(file_path string) *Scanner {
|
||||
if !os.file_exists(file_path) {
|
||||
panic('"$file_path" doesn\'t exist')
|
||||
}
|
||||
//text := os.read_file(file_path)
|
||||
text := os.read_file(file_path) or {
|
||||
panic('scanner: failed to open "$file_path"')
|
||||
return &Scanner{}
|
||||
|
Reference in New Issue
Block a user