mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: format most examples and tutorials, add them to v test-cleancode
(#9826)
This commit is contained in:
@ -2,9 +2,9 @@ module main
|
||||
|
||||
import some_module
|
||||
|
||||
fn main(){
|
||||
fn main() {
|
||||
mut sub := some_module.get_subscriber()
|
||||
sub.subscribe("error", on_error)
|
||||
sub.subscribe('error', on_error)
|
||||
some_module.do_work()
|
||||
}
|
||||
|
||||
|
@ -16,19 +16,19 @@ pub:
|
||||
message string
|
||||
}
|
||||
|
||||
pub fn do_work(){
|
||||
pub fn do_work() {
|
||||
work := Work{20}
|
||||
for i in 0..20 {
|
||||
println("working...")
|
||||
for i in 0 .. 20 {
|
||||
println('working...')
|
||||
if i == 15 {
|
||||
error := &MyError{"There was an error."}
|
||||
eb.publish("error", work, error)
|
||||
eb.publish("error", work, error)
|
||||
error := &MyError{'There was an error.'}
|
||||
some_module.eb.publish('error', work, error)
|
||||
some_module.eb.publish('error', work, error)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_subscriber() eventbus.Subscriber {
|
||||
return *eb.subscriber
|
||||
return *some_module.eb.subscriber
|
||||
}
|
||||
|
Reference in New Issue
Block a user