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

cleanup: fix old usages of os.write_file/2? to os.write_file/2!

This commit is contained in:
Delyan Angelov 2023-01-18 03:18:05 +02:00
parent 6a9688ce9d
commit 2c78078814
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
4 changed files with 10 additions and 10 deletions

View File

@ -5324,7 +5324,7 @@ Full list of builtin options:
import os
fn main() {
embedded_file := $embed_file('v.png')
os.write_file('exported.png', embedded_file.to_string())?
os.write_file('exported.png', embedded_file.to_string())!
}
```
@ -5348,7 +5348,7 @@ Currently only one compression type is supported: `zlib`
import os
fn main() {
embedded_file := $embed_file('v.png', .zlib) // compressed using zlib
os.write_file('exported.png', embedded_file.to_string())?
os.write_file('exported.png', embedded_file.to_string())!
}
```

View File

@ -84,16 +84,16 @@ fn find_file(search_paths []string, file string) ?string {
return error('${file} not found')
}
fn patch_atomic(outfile string, infile string) ? {
lines := os.read_file(infile)?.split('\n')
fn patch_atomic(outfile string, infile string) ! {
lines := os.read_file(infile)!.split('\n')
outlines := lines.filter(!it.contains('atomic(const atomic&) = delete;'))
outtext := outlines.join('\n').replace('#include <bits/atomic_base.h>', '#include "bitsatomicbase.h"')
os.write_file(outfile, outtext)?
os.write_file(outfile, outtext)!
}
fn patch_bitsatomicbase(outfile string, infile string) ? {
lines := os.read_file(infile)?.split('\n')
fn patch_bitsatomicbase(outfile string, infile string) ! {
lines := os.read_file(infile)!.split('\n')
outlines := lines.filter(!it.contains('__atomic_base(const __atomic_base&) = delete;'))
outtext := outlines.join('\n').replace('#include <bits/atomic_base.h>', '#include "bitsatomicbase.h"')
os.write_file(outfile, outtext)?
os.write_file(outfile, outtext)!
}

View File

@ -21,7 +21,7 @@ fn testsuite_end() {
}
fn test_saving_simple_v_program() {
os.write_file(vprogram_file, 'print("hello")')?
os.write_file(vprogram_file, 'print("hello")')!
assert true
}

View File

@ -165,7 +165,7 @@ fn test_closure_return_${styp}_${i}() ? {
wrkdir := os.join_path(os.vtmp_dir(), 'v', 'tests', 'closures')
os.mkdir_all(wrkdir)?
os.chdir(wrkdir)?
os.write_file('closure_return_test.v', code)?
os.write_file('closure_return_test.v', code)!
vexe := os.getenv('VEXE')
res := os.execute('${os.quoted_path(vexe)} -keepc -cg -showcc closure_return_test.v')
if res.exit_code != 0 {