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

fmt: remove space in front of ? and ! (#14366)

This commit is contained in:
Daniel Däschle
2022-05-13 05:56:21 +02:00
committed by GitHub
parent df029da942
commit d679146a80
324 changed files with 1865 additions and 1879 deletions

View File

@ -8,7 +8,7 @@ import term
// it connects to the server who will broadcast your messages
// to all other connected clients
fn main() {
mut ws := start_client() ?
mut ws := start_client()?
println(term.green('client $ws.id ready'))
println('Write message and enter to send...')
for {
@ -16,7 +16,7 @@ fn main() {
if line == '' {
break
}
ws.write_string(line) ?
ws.write_string(line)?
}
ws.close(1000, 'normal') or { println(term.red('panicing $err')) }
unsafe {
@ -25,7 +25,7 @@ fn main() {
}
fn start_client() ?&websocket.Client {
mut ws := websocket.new_client('ws://localhost:30000') ?
mut ws := websocket.new_client('ws://localhost:30000')?
// mut ws := websocket.new_client('wss://echo.websocket.org:443')?
// use on_open_ref if you want to send any reference object
ws.on_open(fn (mut ws websocket.Client) ? {

View File

@ -6,7 +6,7 @@ import term
// this server accepts client connections and broadcast all messages to other connected clients
fn main() {
println('press ctrl-c to quit...')
start_server() ?
start_server()?
}
fn start_server() ? {
@ -20,7 +20,7 @@ fn start_server() ? {
return false
}
return true
}) ?
})?
// on_message_ref, broadcast all incoming messages to all clients except the one sent it
s.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, mut m websocket.Server) ? {

View File

@ -25,7 +25,7 @@ fn start_server() ? {
return false
}
return true
}) ?
})?
s.on_message(fn (mut ws websocket.Client, msg &websocket.Message) ? {
ws.write(msg.payload, msg.opcode) or { panic(err) }
})
@ -41,7 +41,7 @@ fn start_server() ? {
// start_client starts the websocket client, it writes a message to
// the server and prints all the messages received
fn start_client() ? {
mut ws := websocket.new_client('ws://localhost:30000') ?
mut ws := websocket.new_client('ws://localhost:30000')?
// mut ws := websocket.new_client('wss://echo.websocket.org:443')?
// use on_open_ref if you want to send any reference object
ws.on_open(fn (mut ws websocket.Client) ? {
@ -64,7 +64,7 @@ fn start_client() ? {
})
// you can add any pointer reference to use in callback
// t := TestRef{count: 10}
// ws.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, r &SomeRef)? {
// ws.on_message_ref(fn (mut ws websocket.Client, msg &websocket.Message, r &SomeRef) ? {
// // println('type: $msg.opcode payload:\n$msg.payload ref: $r')
// }, &r)
ws.connect() or { println('error on connect: $err') }