mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: fix typos (#19693)
This commit is contained in:
parent
ac40981bcc
commit
690ec7d3a5
43 changed files with 159 additions and 150 deletions
|
@ -28,11 +28,11 @@ The main files are:
|
|||
|
||||
1. `cmd/v/v.v` The entry point.
|
||||
|
||||
- V figures out the build mode.
|
||||
- Constructs the compiler object (`struct V`).
|
||||
- Creates a list of .v files that need to be parsed.
|
||||
- Creates a parser object for each file and runs `parse()` on them.
|
||||
- The correct backend is called (C, JS, native), and a binary is compiled.
|
||||
- V figures out the build mode.
|
||||
- Constructs the compiler object (`struct V`).
|
||||
- Creates a list of .v files that need to be parsed.
|
||||
- Creates a parser object for each file and runs `parse()` on them.
|
||||
- The correct backend is called (C, JS, native), and a binary is compiled.
|
||||
|
||||
2. `vlib/v/scanner` The scanner's job is to parse a list of characters and convert
|
||||
them to tokens.
|
||||
|
@ -84,9 +84,9 @@ accordingly in the steps below.)
|
|||
`https://github.com/YOUR_GITHUB_USERNAME/v` .
|
||||
2. Clone the main v repository https://github.com/vlang/v to a local folder on
|
||||
your computer, say named nv/ (`git clone https://github.com/vlang/v nv`)
|
||||
3. `cd nv`
|
||||
3.1 (optional) Run these commands, which ensure that all your code will be
|
||||
automatically formatted, before commiting:
|
||||
3. `cd nv`
|
||||
3.1 (optional) Run these commands, which ensure that all your code will be
|
||||
automatically formatted, before committing:
|
||||
```
|
||||
cp cmd/tools/git_pre_commit_hook.vsh .git/hooks/pre-commit
|
||||
chmod 755 .git/hooks/pre-commit
|
||||
|
@ -99,10 +99,9 @@ accordingly in the steps below.)
|
|||
`git pull` `git status` and so on.
|
||||
|
||||
5. When finished with a feature/bugfix/change, you can:
|
||||
`git checkout -b fix_alabala`
|
||||
`git checkout -b fix_alabala`
|
||||
- Don't forget to keep formatting standards, run `v fmt -w YOUR_MODIFIED_FILES`
|
||||
before committing (if you have not run the commands from 3.1)
|
||||
|
||||
before committing (if you have not run the commands from 3.1)
|
||||
6. `git push pullrequest` Note: The `pullrequest` remote was setup on step 4
|
||||
|
||||
7. On GitHub's web interface, go to: https://github.com/vlang/v/pulls
|
||||
|
@ -118,10 +117,10 @@ accordingly in the steps below.)
|
|||
9. If there are merge conflicts, or a branch lags too much behind V's master,
|
||||
you can do the following:
|
||||
|
||||
1. `git pull --rebase origin master` # solve conflicts and do
|
||||
`git rebase --continue`
|
||||
2. `git push pullrequest -f` # this will overwrite your current remote branch
|
||||
with the updated version of your changes.
|
||||
1. `git pull --rebase origin master` # solve conflicts and do
|
||||
`git rebase --continue`
|
||||
2. `git push pullrequest -f` # this will overwrite your current remote branch
|
||||
with the updated version of your changes.
|
||||
|
||||
The point of doing the above steps, is to never directly push to the main V
|
||||
repository, *only to your own fork*. Since your local `master` branch tracks the
|
||||
|
@ -135,10 +134,11 @@ information.
|
|||
|
||||
## Finding issues to contribute to
|
||||
|
||||
If you're willing to contribute to V but don't know which issue to resolve
|
||||
If you're willing to contribute to V but don't know which issue to resolve
|
||||
|
||||
- you can go to [Issues](https://github.com/vlang/v/issues) tab
|
||||
in this repository. There you can see things logged by both users and developers
|
||||
that need to be discussed and/or resolved.
|
||||
in this repository. There you can see things logged by both users and developers
|
||||
that need to be discussed and/or resolved.
|
||||
|
||||
It's recommended to filter issues by likes and labels to find an issue
|
||||
you are interested in.
|
||||
|
@ -168,22 +168,25 @@ You can examine the list of labels [here](https://github.com/vlang/v/labels).
|
|||
The most common labels are:
|
||||
|
||||
By issue type:
|
||||
|
||||
- `Bug`
|
||||
- `Feature Request`
|
||||
|
||||
By OS:
|
||||
|
||||
- `OS: Linux`
|
||||
- `OS: Windows`
|
||||
- `OS: Mac`
|
||||
|
||||
By status:
|
||||
|
||||
- `Status: Confirmed`
|
||||
|
||||
To apply this filter, navigate to [Issues](https://github.com/vlang/v/issues)
|
||||
tab, then paste the following in the "Filter" field:
|
||||
|
||||
```
|
||||
is:open is:issue label:Bug label:"OS: Windows" label:"Status: Confirmed"
|
||||
is:open is:issue label:Bug label:"OS: Windows" label:"Status: Confirmed"
|
||||
```
|
||||
|
||||
This filter will return all open issues with the labels `Bug`, `OS: Windows`,
|
||||
|
@ -205,8 +208,8 @@ command.
|
|||
|
||||
1. `hub clone vlang/v my_v`
|
||||
2. `cd my_v`
|
||||
2.1 (optional) Run these commands, which ensure that all your code will be
|
||||
automatically formatted, before commiting:
|
||||
2.1 (optional) Run these commands, which ensure that all your code will be
|
||||
automatically formatted, before committing:
|
||||
```
|
||||
cp cmd/tools/git_pre_commit_hook.vsh .git/hooks/pre-commit
|
||||
chmod 755 .git/hooks/pre-commit
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
## [Version 0.3]
|
||||
|
||||
- [x] gc option
|
||||
- [x] channels
|
||||
- [x] lock{}
|
||||
|
@ -50,7 +51,7 @@
|
|||
- [ ] Cross compilation of C
|
||||
- [ ] Big remaining bugs fixed
|
||||
- [ ] More powerful comptime
|
||||
- [ ] Constraits for generics
|
||||
- [ ] Constrains for generics
|
||||
- [ ] Coroutines on Windows
|
||||
- [ ] Autofree memory management option ready for production
|
||||
- [ ] C2V supporting entire C99 standard
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
Running the C# program:
|
||||
====================================
|
||||
|
||||
```
|
||||
dotnet run
|
||||
```
|
||||
|
||||
Creating a release version of the C# program:
|
||||
|
||||
```
|
||||
dotnet publish -c Release -r ubuntu.20.04-x64
|
||||
```
|
||||
|
@ -16,49 +18,52 @@ but unfortunately it also stops running after stripping :-| .
|
|||
|
||||
Compiling and running the V program:
|
||||
====================================
|
||||
|
||||
```
|
||||
v crun vectors.v
|
||||
```
|
||||
... produces and runs an executable `vectors` which is ~1.3MB in size.
|
||||
|
||||
... produces and runs a `vectors` executable which is ~1.3MB in size.
|
||||
|
||||
Compiling and running the V program, compiled with -prod:
|
||||
|
||||
```
|
||||
v -prod crun vectors.v
|
||||
```
|
||||
... produces and runs an executable `vectors` which is ~176KB in size.
|
||||
|
||||
... produces and runs a `vectors` executable which is ~176KB in size.
|
||||
After stripping, the executable shrinks to 157KB. It can still run after
|
||||
stripping.
|
||||
|
||||
|
||||
Note: using `crun` will make sure that the compilation will happen just
|
||||
once at the start, and then the executable will be just reused by the
|
||||
subsequent commands with identical options. It will also ensure that
|
||||
the compiled executable will not be removed, unlike `run` .
|
||||
|
||||
|
||||
Some measurements and comparisons
|
||||
====================================
|
||||
Note: the folowing was done on Intel(R) Core(TM) i3-3225, 16GB RAM:
|
||||
|
||||
Note: the following was done on Intel(R) Core(TM) i3-3225, 16GB RAM:
|
||||
|
||||
```
|
||||
#0 13:41:35 ᛋ master /v/vnew/bench/vectors❱rm -rf vectors
|
||||
#0 13:41:49 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 13:41:49 ᛋ master /v/vnew/bench/vectors❱v -o vectors_development vectors.v
|
||||
#0 13:42:14 ᛋ master /v/vnew/bench/vectors❱v -o vectors_production -prod vectors.v
|
||||
#0 13:41:49 ᛋ master /v/vnew/bench/vectors❱v -o vectors_development vectors.v
|
||||
#0 13:42:14 ᛋ master /v/vnew/bench/vectors❱v -o vectors_production -prod vectors.v
|
||||
#0 13:42:28 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 13:42:29 ᛋ master /v/vnew/bench/vectors❱hyperfine ./bin/Release/net7.0/ubuntu.20.04-x64/publish/vectors ./vectors_development ./vectors_production
|
||||
Benchmark 1: ./bin/Release/net7.0/ubuntu.20.04-x64/publish/vectors
|
||||
Time (mean ± σ): 347.4 ms ± 7.4 ms [User: 334.4 ms, System: 13.0 ms]
|
||||
Range (min … max): 340.2 ms … 361.7 ms 10 runs
|
||||
|
||||
|
||||
Benchmark 2: ./vectors_development
|
||||
Time (mean ± σ): 882.6 ms ± 14.0 ms [User: 880.3 ms, System: 2.3 ms]
|
||||
Range (min … max): 862.4 ms … 912.9 ms 10 runs
|
||||
|
||||
|
||||
Benchmark 3: ./vectors_production
|
||||
Time (mean ± σ): 217.9 ms ± 9.4 ms [User: 216.8 ms, System: 0.9 ms]
|
||||
Range (min … max): 206.4 ms … 241.3 ms 12 runs
|
||||
|
||||
|
||||
Summary
|
||||
./vectors_production ran
|
||||
1.59 ± 0.08 times faster than ./bin/Release/net7.0/ubuntu.20.04-x64/publish/vectors
|
||||
|
@ -69,8 +74,8 @@ Summary
|
|||
-rwxrwxr-x 1 1000 1000 1320764 Sep 6 13:42 ./vectors_development
|
||||
-rwxr-xr-x 1 1000 1000 66732821 Sep 6 13:40 ./bin/Release/net7.0/ubuntu.20.04-x64/publish/vectors
|
||||
#0 13:45:12 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 13:53:12 ᛋ master /v/vnew/bench/vectors❱alias xtime='/usr/bin/time -f "CPU: %Us\tReal: %es\tElapsed: %E\tRAM: %MKB\t%C"'
|
||||
#0 13:53:42 ᛋ master /v/vnew/bench/vectors❱xtime ./vectors_development
|
||||
#0 13:53:12 ᛋ master /v/vnew/bench/vectors❱alias xtime='/usr/bin/time -f "CPU: %Us\tReal: %es\tElapsed: %E\tRAM: %MKB\t%C"'
|
||||
#0 13:53:42 ᛋ master /v/vnew/bench/vectors❱xtime ./vectors_development
|
||||
5.0498380931718074e+07 - 5.0504723697762154e+07 - 5.040198063489048e+07
|
||||
0.0 - 0.0 - 0.0
|
||||
CPU: 0.87s Real: 0.87s Elapsed: 0:00.87 RAM: 4404KB ./vectors_development
|
||||
|
@ -84,10 +89,10 @@ CPU: 0.20s Real: 0.20s Elapsed: 0:00.20 RAM: 3228KB ./vector
|
|||
CPU: 0.33s Real: 0.34s Elapsed: 0:00.34 RAM: 30544KB ./bin/Release/net7.0/ubuntu.20.04-x64/publish/vectors
|
||||
#0 13:54:02 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 14:01:33 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 14:01:35 ᛋ master /v/vnew/bench/vectors❱xtime v vectors.v
|
||||
#0 14:01:35 ᛋ master /v/vnew/bench/vectors❱xtime v vectors.v
|
||||
CPU: 0.41s Real: 0.36s Elapsed: 0:00.36 RAM: 59412KB v vectors.v
|
||||
#0 14:01:41 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 14:01:42 ᛋ master /v/vnew/bench/vectors❱xtime v -prod vectors.v
|
||||
#0 14:01:42 ᛋ master /v/vnew/bench/vectors❱xtime v -prod vectors.v
|
||||
CPU: 4.97s Real: 5.11s Elapsed: 0:05.11 RAM: 80732KB v -prod vectors.v
|
||||
#0 14:01:48 ᛋ master /v/vnew/bench/vectors❱
|
||||
#0 14:01:50 ᛋ master /v/vnew/bench/vectors❱xtime dotnet publish -c Release -r ubuntu.20.04-x64
|
||||
|
|
|
@ -260,7 +260,7 @@ fn test_bf_pos() {
|
|||
* set haystack size to 80
|
||||
* test different sizes of needle, from 1 to 80
|
||||
* test different positions of needle, from 0 to where it fits
|
||||
* all haystacks here contain exactly one instanse of needle,
|
||||
* all haystacks here contain exactly one instance of needle,
|
||||
* so search should return non-negative-values
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,7 @@ fn (b &BloomFilter[T]) free() {
|
|||
}
|
||||
}
|
||||
|
||||
// new_bloom_filter_fast create a new bloom_filter. `table_size` is 16384 , and `num_functions` is 4
|
||||
// new_bloom_filter_fast creates a new bloom_filter. `table_size` is 16384, and `num_functions` is 4.
|
||||
pub fn new_bloom_filter_fast[T](hash_func fn (T) u32) &BloomFilter[T] {
|
||||
return &BloomFilter[T]{
|
||||
hash_func: hash_func
|
||||
|
@ -48,7 +48,7 @@ pub fn new_bloom_filter_fast[T](hash_func fn (T) u32) &BloomFilter[T] {
|
|||
}
|
||||
}
|
||||
|
||||
// new_bloom_filter create a new bloom_filter. `table_size` should greate than 0 , and `num_functions` should be 1~16
|
||||
// new_bloom_filter creates a new bloom_filter. `table_size` should be greater than 0, and `num_functions` should be 1~16.
|
||||
pub fn new_bloom_filter[T](hash_func fn (T) u32, table_size int, num_functions int) !&BloomFilter[T] {
|
||||
if table_size <= 0 {
|
||||
return error('table_size should great that 0')
|
||||
|
|
|
@ -10,10 +10,10 @@ fn hash_func(s string) u32 {
|
|||
fn test_bloom_filter_fast() {
|
||||
mut b := new_bloom_filter_fast[string](hash_func)
|
||||
b.add('hello world')
|
||||
b.add('v is awsome')
|
||||
b.add('v is awesome')
|
||||
b.add('power by v')
|
||||
assert b.exists('hello world') == true
|
||||
assert b.exists('v is awsome') == true
|
||||
assert b.exists('v is awesome') == true
|
||||
assert b.exists('power by v') == true
|
||||
assert b.exists('my world') == false
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ fn test_bloom_filter_fast() {
|
|||
fn test_bloom_filter_fast_normal() {
|
||||
mut b := new_bloom_filter[string](hash_func, 65536, 16) or { panic(err) }
|
||||
b.add('hello world')
|
||||
b.add('v is awsome')
|
||||
b.add('v is awesome')
|
||||
b.add('power by v')
|
||||
assert b.exists('hello world') == true
|
||||
assert b.exists('v is awsome') == true
|
||||
assert b.exists('v is awesome') == true
|
||||
assert b.exists('power by v') == true
|
||||
assert b.exists('my world') == false
|
||||
}
|
||||
|
@ -33,10 +33,10 @@ fn test_bloom_filter_false_positive() {
|
|||
// every `add` will set 8 bits in the table(total length = 16), so overflow very quickly
|
||||
mut b := new_bloom_filter[string](hash_func, 16, 8) or { panic(err) }
|
||||
b.add('hello world')
|
||||
b.add('v is awsome')
|
||||
b.add('v is awesome')
|
||||
b.add('power by v')
|
||||
assert b.exists('hello world') == true
|
||||
assert b.exists('v is awsome') == true
|
||||
assert b.exists('v is awesome') == true
|
||||
assert b.exists('power by v') == true
|
||||
assert b.exists('my world') == true // false positive
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ fn test_bloom_filter_fast_union_intersection() {
|
|||
a.add('super rust')
|
||||
|
||||
b.add('hello world')
|
||||
b.add('v is awsome')
|
||||
b.add('v is awesome')
|
||||
b.add('power by v')
|
||||
|
||||
assert a.exists('power by v') == true
|
||||
|
@ -59,7 +59,7 @@ fn test_bloom_filter_fast_union_intersection() {
|
|||
assert a.exists('power c++') == false
|
||||
|
||||
assert b.exists('hello world') == true
|
||||
assert b.exists('v is awsome') == true
|
||||
assert b.exists('v is awesome') == true
|
||||
assert b.exists('power by v') == true
|
||||
assert b.exists('my world') == false
|
||||
|
||||
|
@ -69,7 +69,7 @@ fn test_bloom_filter_fast_union_intersection() {
|
|||
assert c.exists('super rust') == true
|
||||
assert c.exists('power c++') == false
|
||||
assert c.exists('hello world') == true
|
||||
assert c.exists('v is awsome') == true
|
||||
assert c.exists('v is awesome') == true
|
||||
assert c.exists('power by v') == true
|
||||
assert c.exists('my world') == false
|
||||
|
||||
|
@ -79,7 +79,7 @@ fn test_bloom_filter_fast_union_intersection() {
|
|||
assert d.exists('super rust') == false
|
||||
assert d.exists('power c++') == false
|
||||
assert d.exists('hello world') == false
|
||||
assert d.exists('v is awsome') == false
|
||||
assert d.exists('v is awesome') == false
|
||||
assert d.exists('power by v') == true
|
||||
assert d.exists('my world') == false
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module datatypes
|
||||
|
||||
/// Internal rapresentation of the tree node
|
||||
/// Internal representation of the tree node
|
||||
[heap]
|
||||
struct BSTreeNode[T] {
|
||||
mut:
|
||||
|
@ -234,7 +234,7 @@ fn (bst &BSTree[T]) pre_order_traversal_helper(node &BSTreeNode[T], mut result [
|
|||
bst.pre_order_traversal_helper(node.right, mut result)
|
||||
}
|
||||
|
||||
// get_node is a helper method to ge the internal rapresentation of the node with the `value`.
|
||||
// get_node is a helper method to ge the internal representation of the node with the `value`.
|
||||
fn (bst &BSTree[T]) get_node(node &BSTreeNode[T], value T) &BSTreeNode[T] {
|
||||
if unsafe { node == 0 } || !node.is_init {
|
||||
return new_none_node[T](false)
|
||||
|
|
|
@ -86,7 +86,7 @@ fn test_get_left_on_empty_bst() {
|
|||
}
|
||||
|
||||
// Check the remove operation if it is able to remove
|
||||
// all elements required, and mantains the BST propriety.
|
||||
// all elements required, and maintains the BST propriety.
|
||||
fn test_remove_from_bst_one() {
|
||||
mut bst := BSTree[int]{}
|
||||
assert bst.insert(10)
|
||||
|
|
|
@ -29,7 +29,7 @@ mut:
|
|||
deleted_at time.Time
|
||||
}
|
||||
|
||||
struct TestDefaultAtribute {
|
||||
struct TestDefaultAttribute {
|
||||
id string [primary; sql: serial]
|
||||
name string
|
||||
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
||||
|
@ -205,13 +205,13 @@ fn test_mysql_orm() {
|
|||
/** test default attribute
|
||||
*/
|
||||
sql db {
|
||||
create table TestDefaultAtribute
|
||||
create table TestDefaultAttribute
|
||||
}!
|
||||
|
||||
mut result_defaults := db.query("
|
||||
SELECT COLUMN_DEFAULT
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'TestDefaultAtribute'
|
||||
WHERE TABLE_NAME = 'TestDefaultAttribute'
|
||||
ORDER BY ORDINAL_POSITION
|
||||
") or {
|
||||
println(err)
|
||||
|
@ -220,7 +220,7 @@ fn test_mysql_orm() {
|
|||
mut information_schema_defaults_results := []string{}
|
||||
|
||||
sql db {
|
||||
drop table TestDefaultAtribute
|
||||
drop table TestDefaultAttribute
|
||||
}!
|
||||
|
||||
information_schema_column_default_sql := [{
|
||||
|
|
|
@ -29,7 +29,7 @@ mut:
|
|||
deleted_at time.Time
|
||||
}
|
||||
|
||||
struct TestDefaultAtribute {
|
||||
struct TestDefaultAttribute {
|
||||
id string [default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
|
||||
name string
|
||||
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
||||
|
@ -202,13 +202,13 @@ fn test_pg_orm() {
|
|||
/** test default attribute
|
||||
*/
|
||||
sql db {
|
||||
create table TestDefaultAtribute
|
||||
create table TestDefaultAttribute
|
||||
}!
|
||||
|
||||
mut result_defaults := db.exec("
|
||||
SELECT column_default
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'TestDefaultAtribute'
|
||||
WHERE TABLE_NAME = 'TestDefaultAttribute'
|
||||
ORDER BY ORDINAL_POSITION
|
||||
") or {
|
||||
println(err)
|
||||
|
@ -220,7 +220,7 @@ fn test_pg_orm() {
|
|||
information_schema_defaults_results << defaults.vals[0]
|
||||
}
|
||||
sql db {
|
||||
drop table TestDefaultAtribute
|
||||
drop table TestDefaultAttribute
|
||||
}!
|
||||
assert ['gen_random_uuid()', '', 'CURRENT_TIMESTAMP'] == information_schema_defaults_results
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct TestCustomSqlType {
|
|||
custom6 time.Time
|
||||
}
|
||||
|
||||
struct TestDefaultAtribute {
|
||||
struct TestDefaultAttribute {
|
||||
id string [primary; sql: serial]
|
||||
name string
|
||||
created_at ?string [default: 'CURRENT_TIME']
|
||||
|
@ -124,11 +124,11 @@ fn test_sqlite_orm() {
|
|||
*/
|
||||
|
||||
sql db {
|
||||
create table TestDefaultAtribute
|
||||
create table TestDefaultAttribute
|
||||
}!
|
||||
|
||||
mut result_default_sql := db.exec('
|
||||
pragma table_info(TestDefaultAtribute);
|
||||
pragma table_info(TestDefaultAttribute);
|
||||
')!
|
||||
|
||||
mut information_schema_data_types_results := []string{}
|
||||
|
@ -139,29 +139,29 @@ fn test_sqlite_orm() {
|
|||
}
|
||||
assert information_schema_data_types_results == information_schema_default_sql
|
||||
|
||||
test_default_atribute := TestDefaultAtribute{
|
||||
test_default_attribute := TestDefaultAttribute{
|
||||
name: 'Hitalo'
|
||||
}
|
||||
|
||||
sql db {
|
||||
insert test_default_atribute into TestDefaultAtribute
|
||||
insert test_default_attribute into TestDefaultAttribute
|
||||
}!
|
||||
|
||||
test_default_atributes := sql db {
|
||||
select from TestDefaultAtribute limit 1
|
||||
test_default_attributes := sql db {
|
||||
select from TestDefaultAttribute limit 1
|
||||
}!
|
||||
|
||||
result_test_default_atribute := test_default_atributes.first()
|
||||
assert result_test_default_atribute.name == 'Hitalo'
|
||||
assert test_default_atribute.created_at or { '' } == ''
|
||||
assert test_default_atribute.created_at1 or { '' } == ''
|
||||
assert test_default_atribute.created_at2 or { '' } == ''
|
||||
assert result_test_default_atribute.created_at or { '' }.len == 8 // HH:MM:SS
|
||||
assert result_test_default_atribute.created_at1 or { '' }.len == 10 // YYYY-MM-DD
|
||||
assert result_test_default_atribute.created_at2 or { '' }.len == 19 // YYYY-MM-DD HH:MM:SS
|
||||
result_test_default_attribute := test_default_attributes.first()
|
||||
assert result_test_default_attribute.name == 'Hitalo'
|
||||
assert test_default_attribute.created_at or { '' } == ''
|
||||
assert test_default_attribute.created_at1 or { '' } == ''
|
||||
assert test_default_attribute.created_at2 or { '' } == ''
|
||||
assert result_test_default_attribute.created_at or { '' }.len == 8 // HH:MM:SS
|
||||
assert result_test_default_attribute.created_at1 or { '' }.len == 10 // YYYY-MM-DD
|
||||
assert result_test_default_attribute.created_at2 or { '' }.len == 19 // YYYY-MM-DD HH:MM:SS
|
||||
|
||||
sql db {
|
||||
drop table TestDefaultAtribute
|
||||
drop table TestDefaultAttribute
|
||||
}!
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ fn test_over() {
|
|||
semi_r := gx.Color{255, 0, 0, 128}
|
||||
semi_g := gx.Color{0, 255, 0, 128}
|
||||
semi_b := gx.Color{0, 0, 255, 128}
|
||||
// fully opaque colors, should be preserved when layed *over* any others:
|
||||
// fully opaque colors, should be preserved when laid *over* any others:
|
||||
assert b.over(g) == b
|
||||
assert r.over(g) == r
|
||||
assert y.over(r) == y
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn (l &Log) get_level() Level {
|
|||
return l.level
|
||||
}
|
||||
|
||||
// set_level sets the logging level to `level`. Messges for levels above it will skipped.
|
||||
// set_level sets the logging level to `level`. Messages for levels above it will skipped.
|
||||
// For example, after calling log.set_level(.info), log.debug('message') will produce nothing.
|
||||
// Call log.set_level(.disabled) to turn off the logging of all messages.
|
||||
pub fn (mut l Log) set_level(level Level) {
|
||||
|
|
|
@ -4,7 +4,7 @@ module picoev
|
|||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
|
||||
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timout &C.timespec) int
|
||||
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timeout &C.timespec) int
|
||||
fn C.kqueue() int
|
||||
fn C.EV_SET(kev voidptr, ident int, filter i16, flags u16, fflags u32, data voidptr, udata voidptr)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ module picoev
|
|||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
|
||||
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timout &C.timespec) int
|
||||
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timeout &C.timespec) int
|
||||
fn C.kqueue() int
|
||||
fn C.EV_SET(kev voidptr, ident int, filter i16, flags u16, fflags u32, data voidptr, udata voidptr)
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ fn fatal_socket_error(fd int) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// listen creates a listening tcp socket and returns its file decriptor
|
||||
// listen creates a listening tcp socket and returns its file descriptor
|
||||
fn listen(config Config) int {
|
||||
// not using the `net` modules sockets, because not all socket options are defined
|
||||
fd := C.socket(net.AddrFamily.ip, net.SocketType.tcp, 0)
|
||||
|
|
|
@ -407,7 +407,7 @@ pub fn (mut rng PRNG) binomial(n int, p f64) !int {
|
|||
return count
|
||||
}
|
||||
|
||||
// exponential returns an exponentially distributed random number with the rate paremeter
|
||||
// exponential returns an exponentially distributed random number with the rate parameter
|
||||
// lambda. It is expected that lambda is positive.
|
||||
pub fn (mut rng PRNG) exponential(lambda f64) f64 {
|
||||
if lambda <= 0 {
|
||||
|
@ -748,7 +748,7 @@ pub fn binomial(n int, p f64) !int {
|
|||
return default_rng.binomial(n, p)
|
||||
}
|
||||
|
||||
// exponential returns an exponentially distributed random number with the rate paremeter
|
||||
// exponential returns an exponentially distributed random number with the rate parameter
|
||||
// lambda. It is expected that lambda is positive.
|
||||
pub fn exponential(lambda f64) f64 {
|
||||
return default_rng.exponential(lambda)
|
||||
|
|
|
@ -334,7 +334,7 @@ fn converter(mut pn PrepNumber) u64 {
|
|||
*/
|
||||
|
||||
// C.printf(c"mantissa before rounding: %08x%08x%08x binexp: %d \n", s2,s1,s0,binexp)
|
||||
// s1 => 0xFFFFFFxx only F are rapresented
|
||||
// s1 => 0xFFFFFFxx only F are represented
|
||||
nbit := 7
|
||||
check_round_bit := u32(1) << u32(nbit)
|
||||
check_round_mask := u32(0xFFFFFFFF) << u32(nbit)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
module term
|
||||
|
||||
#const $tty = require('tty');
|
||||
// get_terminal_size returns a number of colums and rows of terminal window.
|
||||
// get_terminal_size returns a number of columns and rows of terminal window.
|
||||
pub fn get_terminal_size() (int, int) {
|
||||
$if js_node {
|
||||
colums := 0
|
||||
cols := 0
|
||||
rows := 0
|
||||
#let sizes = $tty.WriteStream(1).getWindowSize();
|
||||
#colums.val = sizes[0];
|
||||
#cols.val = sizes[0];
|
||||
#rows.val = sizes[1];
|
||||
|
||||
return colums, rows
|
||||
return cols, rows
|
||||
} $else {
|
||||
return default_columns_size, default_rows_size
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub:
|
|||
|
||||
fn C.ioctl(fd int, request u64, arg voidptr) int
|
||||
|
||||
// get_terminal_size returns a number of colums and rows of terminal window.
|
||||
// get_terminal_size returns a number of columns and rows of terminal window.
|
||||
pub fn get_terminal_size() (int, int) {
|
||||
if os.is_atty(1) <= 0 || os.getenv('TERM') == 'dumb' {
|
||||
return default_columns_size, default_rows_size
|
||||
|
|
|
@ -180,7 +180,7 @@ fn supports_truecolor() bool {
|
|||
if os.getenv('COLORTERM') in ['truecolor', '24bit'] {
|
||||
return true
|
||||
}
|
||||
// set the bg color to some arbirtrary value (#010203), assumed not to be the default
|
||||
// set the bg color to some arbitrary value (#010203), assumed not to be the default
|
||||
print('\x1b[48:2:1:2:3m')
|
||||
flush_stdout()
|
||||
// andquery the current color
|
||||
|
|
|
@ -490,7 +490,7 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
|
|||
if r is ast.Ident {
|
||||
obj := r.obj
|
||||
if obj is ast.Var && !obj.is_mut {
|
||||
c.warn('cannot add a referenece to an immutable object to a mutable array',
|
||||
c.warn('cannot add a reference to an immutable object to a mutable array',
|
||||
elem_expr.pos)
|
||||
}
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.',
|
|||
if left_sym.kind == .function && right_sym.info is ast.FnType {
|
||||
return_sym := c.table.sym(right_sym.info.func.return_type)
|
||||
if return_sym.kind == .placeholder {
|
||||
c.error('unkown return type: cannot assign `${right}` as a function variable',
|
||||
c.error('unknown return type: cannot assign `${right}` as a function variable',
|
||||
right.pos())
|
||||
} else if (!right_sym.info.is_anon && return_sym.kind == .any)
|
||||
|| (return_sym.info is ast.Struct && return_sym.info.is_generic) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
vlib/v/checker/tests/array_of_refs_mutability.vv:11:14: warning: cannot add a referenece to an immutable object to a mutable array
|
||||
vlib/v/checker/tests/array_of_refs_mutability.vv:11:14: warning: cannot add a reference to an immutable object to a mutable array
|
||||
9 | }
|
||||
10 |
|
||||
11 | mut arr := [&x]
|
||||
| ^
|
||||
12 | arr[0].bar = 30
|
||||
13 |
|
||||
vlib/v/checker/tests/array_of_refs_mutability.vv:15:10: warning: cannot add a referenece to an immutable object to a mutable array
|
||||
vlib/v/checker/tests/array_of_refs_mutability.vv:15:10: warning: cannot add a reference to an immutable object to a mutable array
|
||||
13 |
|
||||
14 | mut arr2 := [&Foo{}]
|
||||
15 | arr2 = [&x]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/invalid_insert_references_test.vv:4:12: warning: cannot add a referenece to an immutable object to a mutable array
|
||||
vlib/v/checker/tests/invalid_insert_references_test.vv:4:12: warning: cannot add a reference to an immutable object to a mutable array
|
||||
2 | fn test_invalid_insert_references() {
|
||||
3 | b := 0
|
||||
4 | mut a := [&b]
|
||||
|
|
|
@ -5,7 +5,7 @@ Did you mean `[2]fn (u32) UnknownThing`?
|
|||
| ~~~~~~~~~~~~
|
||||
3 | }
|
||||
4 |
|
||||
vlib/v/checker/tests/unknown_array_fn_type_in_struct_field.vv:6:18: error: unkown return type: cannot assign `virt.fns[0]` as a function variable
|
||||
vlib/v/checker/tests/unknown_array_fn_type_in_struct_field.vv:6:18: error: unknown return type: cannot assign `virt.fns[0]` as a function variable
|
||||
4 |
|
||||
5 | fn (virt Virt) caller() {
|
||||
6 | func := virt.fns[0]
|
||||
|
|
|
@ -327,13 +327,13 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
|
|||
last_import_stmt_idx = sidx
|
||||
}
|
||||
}
|
||||
mut preceeding_comments := []DocComment{}
|
||||
mut preceding_comments := []DocComment{}
|
||||
// mut imports_section := true
|
||||
for sidx, mut stmt in file_ast.stmts {
|
||||
if mut stmt is ast.ExprStmt {
|
||||
// Collect comments
|
||||
if mut stmt.expr is ast.Comment {
|
||||
preceeding_comments << ast_comment_to_doc_comment(stmt.expr)
|
||||
preceding_comments << ast_comment_to_doc_comment(stmt.expr)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -343,13 +343,13 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
|
|||
continue
|
||||
}
|
||||
// the previous comments were probably a copyright/license one
|
||||
module_comment := merge_doc_comments(preceeding_comments)
|
||||
preceeding_comments = []
|
||||
module_comment := merge_doc_comments(preceding_comments)
|
||||
preceding_comments = []
|
||||
if !d.is_vlib && !module_comment.starts_with('Copyright (c)') {
|
||||
if module_comment == '' {
|
||||
continue
|
||||
}
|
||||
d.head.comments << preceeding_comments
|
||||
d.head.comments << preceding_comments
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
@ -357,16 +357,16 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
|
|||
// the accumulated comments were interspersed before/between the imports;
|
||||
// just add them all to the module comments:
|
||||
if d.with_head {
|
||||
d.head.comments << preceeding_comments
|
||||
d.head.comments << preceding_comments
|
||||
}
|
||||
preceeding_comments = []
|
||||
preceding_comments = []
|
||||
// imports_section = false
|
||||
}
|
||||
if stmt is ast.Import {
|
||||
continue
|
||||
}
|
||||
mut node := d.stmt(mut stmt, os.base(file_ast.path)) or {
|
||||
preceeding_comments = []
|
||||
preceding_comments = []
|
||||
continue
|
||||
}
|
||||
if node.parent_name !in contents {
|
||||
|
@ -380,10 +380,10 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
|
|||
kind: parent_node_kind
|
||||
}
|
||||
}
|
||||
if d.with_comments && preceeding_comments.len > 0 {
|
||||
node.comments << preceeding_comments
|
||||
if d.with_comments && preceding_comments.len > 0 {
|
||||
node.comments << preceding_comments
|
||||
}
|
||||
preceeding_comments = []
|
||||
preceding_comments = []
|
||||
if node.parent_name.len > 0 {
|
||||
parent_name := node.parent_name
|
||||
if node.parent_name == 'Constants' {
|
||||
|
|
|
@ -276,7 +276,7 @@ pub fn (mut e Eval) register_symbol(stmt ast.Stmt, mod string, file string) {
|
|||
}
|
||||
|
||||
fn (e Eval) error(msg string) {
|
||||
eprintln('> V interpeter backtrace:')
|
||||
eprintln('> V interpreter backtrace:')
|
||||
e.print_backtrace()
|
||||
util.verror('interpreter', msg)
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ pub fn (mut e Eval) stmt(stmt ast.Stmt) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
e.error('unknown assign statment: ${stmt.op}')
|
||||
e.error('unknown assign statement: ${stmt.op}')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ pub fn (mut e Eval) set(expr ast.Expr, val Object, init bool, typ ast.Type) {
|
|||
// }
|
||||
}
|
||||
else {
|
||||
panic('unknown left value to assign statment: ${expr.type_name()}')
|
||||
panic('unknown left value to assign statement: ${expr.type_name()}')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ pub fn (mut e Eval) add(expr ast.Expr, val Object) {
|
|||
.plus, e.local_vars[expr.name].typ)
|
||||
}
|
||||
else {
|
||||
panic('unknown left value to add statment: ${expr.type_name()}')
|
||||
panic('unknown left value to add statement: ${expr.type_name()}')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,8 +191,8 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
|
|||
continue
|
||||
}
|
||||
}
|
||||
if already_initalised_node_field_index := inited_fields[field.name] {
|
||||
mut sfield := node.init_fields[already_initalised_node_field_index]
|
||||
if already_inited_node_field_index := inited_fields[field.name] {
|
||||
mut sfield := node.init_fields[already_inited_node_field_index]
|
||||
if sfield.typ == 0 {
|
||||
continue
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
|
|||
if node.no_keys && sym.kind == .struct_ {
|
||||
sym_info := sym.info as ast.Struct
|
||||
if sym_info.fields.len == node.init_fields.len {
|
||||
sfield.name = sym_info.fields[already_initalised_node_field_index].name
|
||||
sfield.name = sym_info.fields[already_inited_node_field_index].name
|
||||
}
|
||||
}
|
||||
g.struct_init_field(sfield, sym.language)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
================ V panic ================
|
||||
module: main
|
||||
function: buggy_function()
|
||||
message: panicing...
|
||||
message: panicking...
|
||||
file: vlib/v/slow_tests/inout/panic_with_cg.vv:2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
fn buggy_function() {
|
||||
panic('panicing...')
|
||||
panic('panicking...')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -11,7 +11,7 @@ fn (b Bar) foo() int {
|
|||
return b.f[0](22)
|
||||
}
|
||||
|
||||
fn test_array_of_fns_index_call_with_direct_array_acess() {
|
||||
fn test_array_of_fns_index_call_with_direct_array_access() {
|
||||
bar := Bar{[func]}
|
||||
ret := bar.foo()
|
||||
println(ret)
|
||||
|
|
|
@ -11,10 +11,10 @@ fn init_b(n_rows int) []map[int]int {
|
|||
return tally
|
||||
}
|
||||
|
||||
pub fn tallys_in_array(indexs []int, values [][]int, init fn (int) []map[int]int) []map[int]int {
|
||||
mut tally := init(indexs.len)
|
||||
pub fn tallys_in_array(indices []int, values [][]int, init fn (int) []map[int]int) []map[int]int {
|
||||
mut tally := init(indices.len)
|
||||
for row in 0 .. values.len {
|
||||
for i, index in indexs {
|
||||
for i, index in indices {
|
||||
tally[i][values[row][index]]++
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ pub fn tallys_in_array(indexs []int, values [][]int, init fn (int) []map[int]int
|
|||
}
|
||||
|
||||
fn test_array_of_map_with_default() {
|
||||
indexs := [0, 1]
|
||||
indices := [0, 1]
|
||||
values := [[1, 201], [1, 3], [1, 201], [1, 3]]
|
||||
|
||||
out1 := tallys_in_array(indexs, values, init_a)
|
||||
out1 := tallys_in_array(indices, values, init_a)
|
||||
println(out1)
|
||||
out2 := tallys_in_array(indexs, values, init_b)
|
||||
out2 := tallys_in_array(indices, values, init_b)
|
||||
println(out2)
|
||||
|
||||
mut maps := []map[int]int{}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
pub type MenuItem = Action | Group | Separater
|
||||
pub type MenuItem = Action | Group | Separator
|
||||
|
||||
pub struct Group {
|
||||
children []MenuItem
|
||||
}
|
||||
|
||||
pub struct Separater {}
|
||||
pub struct Separator {}
|
||||
|
||||
pub struct Action {}
|
||||
|
||||
|
@ -12,7 +12,7 @@ fn test_array_of_sumtype_init() {
|
|||
g := Group{
|
||||
children: [
|
||||
Action{},
|
||||
Separater{},
|
||||
Separator{},
|
||||
Group{
|
||||
children: [
|
||||
Action{},
|
||||
|
|
|
@ -14,7 +14,7 @@ fn (x St) val() int {
|
|||
return x.n
|
||||
}
|
||||
|
||||
fn owerwrite_stack() f64 {
|
||||
fn overwrite_stack() f64 {
|
||||
a := 12.5
|
||||
b := 3.5
|
||||
c := a + b
|
||||
|
@ -37,7 +37,7 @@ fn return_interface(x St) MyInterface {
|
|||
|
||||
fn test_gen_interface() {
|
||||
i1 := gen_interface()
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert i1.val() == -123
|
||||
assert d == 16.0
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn test_convert_to_interface() {
|
|||
n: 5
|
||||
}
|
||||
i2 := return_interface(x)
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert i2.val() == 5
|
||||
assert d == 16.0
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ fn get_ref_structs() (&Abc, &St, &Qwe) {
|
|||
return aa, bb, xx
|
||||
}
|
||||
|
||||
fn owerwrite_stack() f64 {
|
||||
fn overwrite_stack() f64 {
|
||||
a := 12.5
|
||||
b := 3.5
|
||||
c := a + b
|
||||
|
@ -54,7 +54,7 @@ fn owerwrite_stack() f64 {
|
|||
|
||||
fn test_ref_struct() {
|
||||
u, v, w := get_ref_structs()
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert u.n == 3
|
||||
assert v.n == 7
|
||||
assert w.a.n == 23
|
||||
|
@ -74,7 +74,7 @@ fn test_value_ref_heap_struct() {
|
|||
}
|
||||
y := return_heap_obj_value_as_ref(x)
|
||||
x.f = 22.0625
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert typeof(y).name == '&Qwe'
|
||||
assert x.f == 22.0625
|
||||
assert x.a.n == -129
|
||||
|
@ -98,7 +98,7 @@ fn test_value_ref_struct() {
|
|||
}
|
||||
y := return_struct_value_as_ref(x)
|
||||
x.f = 91.0625
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert typeof(y).name == '&NotHeap'
|
||||
assert y.f == -17.125
|
||||
assert x.f == 91.0625
|
||||
|
@ -113,7 +113,7 @@ fn get_int_ref() &int {
|
|||
fn test_int_ref() {
|
||||
iptr := get_int_ref()
|
||||
assert typeof(iptr).name == '&int'
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert *iptr == 49154
|
||||
assert d == 16.0
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ fn test_value_as_ref() {
|
|||
y := pass_f64_as_ref(x)
|
||||
assert typeof(y).name == '&f64'
|
||||
x = 23.0625
|
||||
d := owerwrite_stack()
|
||||
d := overwrite_stack()
|
||||
assert x == 23.0625
|
||||
assert *y == -31.75
|
||||
assert d == 16.0
|
||||
|
|
|
@ -225,12 +225,12 @@ pub fn (mut app App) middleware_auth() vweb.Result {
|
|||
// ======================================
|
||||
|
||||
pub fn (mut app App) shutdown() vweb.Result {
|
||||
spawn app.gracefull_exit()
|
||||
spawn app.exit_gracefully()
|
||||
return app.ok('good bye')
|
||||
}
|
||||
|
||||
fn (mut app App) gracefull_exit() {
|
||||
eprintln('>> webserver: gracefull_exit')
|
||||
fn (mut app App) exit_gracefully() {
|
||||
eprintln('>> webserver: exit_gracefully')
|
||||
time.sleep(100 * time.millisecond)
|
||||
exit(0)
|
||||
}
|
||||
|
|
|
@ -107,12 +107,12 @@ pub fn (mut app App) shutdown() vweb.Result {
|
|||
if session_key != 'superman' {
|
||||
return app.not_found()
|
||||
}
|
||||
spawn app.gracefull_exit()
|
||||
spawn app.exit_gracefully()
|
||||
return app.ok('good bye')
|
||||
}
|
||||
|
||||
fn (mut app App) gracefull_exit() {
|
||||
eprintln('>> webserver: gracefull_exit')
|
||||
fn (mut app App) exit_gracefully() {
|
||||
eprintln('>> webserver: exit_gracefully')
|
||||
time.sleep(100 * time.millisecond)
|
||||
exit(0)
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ fn simple_tcp_client(config SimpleTcpClientConfig) !string {
|
|||
break
|
||||
}
|
||||
if client == unsafe { nil } {
|
||||
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
exit(1)
|
||||
}
|
||||
client.set_read_timeout(tcp_r_timeout)
|
||||
|
@ -330,7 +330,7 @@ fn simple_tcp_client_post_json(config SimpleTcpClientConfig) !string {
|
|||
break
|
||||
}
|
||||
if client == unsafe { nil } {
|
||||
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
exit(1)
|
||||
}
|
||||
client.set_read_timeout(tcp_r_timeout)
|
||||
|
|
|
@ -275,12 +275,12 @@ pub fn (mut app App) shutdown() vweb.Result {
|
|||
if session_key != 'superman' {
|
||||
return app.not_found()
|
||||
}
|
||||
spawn app.gracefull_exit()
|
||||
spawn app.exit_gracefully()
|
||||
return app.ok('good bye')
|
||||
}
|
||||
|
||||
fn (mut app App) gracefull_exit() {
|
||||
eprintln('>> webserver: gracefull_exit')
|
||||
fn (mut app App) exit_gracefully() {
|
||||
eprintln('>> webserver: exit_gracefully')
|
||||
time.sleep(100 * time.millisecond)
|
||||
exit(0)
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ fn simple_tcp_client(config SimpleTcpClientConfig) !string {
|
|||
break
|
||||
}
|
||||
if client == unsafe { nil } {
|
||||
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
|
||||
exit(1)
|
||||
}
|
||||
client.set_read_timeout(tcp_r_timeout)
|
||||
|
|
|
@ -135,12 +135,12 @@ pub fn (mut app App) shutdown() vweb.Result {
|
|||
if session_key != 'superman' {
|
||||
return app.not_found()
|
||||
}
|
||||
spawn app.gracefull_exit()
|
||||
spawn app.exit_gracefully()
|
||||
return app.ok('good bye')
|
||||
}
|
||||
|
||||
fn (mut app App) gracefull_exit() {
|
||||
eprintln('>> webserver: gracefull_exit')
|
||||
fn (mut app App) exit_gracefully() {
|
||||
eprintln('>> webserver: exit_gracefully')
|
||||
time.sleep(100 * time.millisecond)
|
||||
exit(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue