[go-nuts] Re: Are defered function calls executed?

2019-01-04 Thread alive . seek
if err not equal nil ,defer not push stack yet,so it wont execute. As below it will execute func main() { src, err := os.Open("text.txt") defer src.Close() if err != nil { return } } On Friday, January 4, 2019 at 2:09:51 PM UTC+8, 伊藤和也 wrote: > > In the first example, "ok" was

[go-nuts] help(rest call failed)

2018-11-12 Thread alive . seek
I just want to send a rest call with golang, but it failed, the error message : {"header":{"code":201,"desc":"param data not exist"}} .(but when I send rest request with postman ,it success) the code as follow 1 package main 2 3 import( 4 "net/http" 5 "fmt" 6