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

examples: fix v build-examples

This commit is contained in:
Delyan Angelov
2020-07-24 13:29:47 +03:00
parent 5acc437367
commit bfca55b87a
8 changed files with 38 additions and 39 deletions

View File

@ -2,7 +2,7 @@ import net.http
import sync
import time
fn vlang_time(wg &sync.WaitGroup) ?string {
fn vlang_time(mut wg sync.WaitGroup) ?string {
start := time.ticks()
data := http.get('https://vlang.io/utc_now')?
finish := time.ticks()
@ -12,7 +12,7 @@ fn vlang_time(wg &sync.WaitGroup) ?string {
return data.text
}
fn remote_ip(wg &sync.WaitGroup) ?string {
fn remote_ip(mut wg sync.WaitGroup) ?string {
start := time.ticks()
data := http.get('https://api.ipify.org')?
finish := time.ticks()
@ -23,10 +23,10 @@ fn remote_ip(wg &sync.WaitGroup) ?string {
}
fn main() {
wg := sync.new_waitgroup()
mut wg := sync.new_waitgroup()
wg.add(2)
// Run tasks async
go vlang_time(wg)
go remote_ip(wg)
go vlang_time(mut wg)
go remote_ip(mut wg)
wg.wait()
}