online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// You can edit this code! // Click here and start typing. package main import ( "fmt" "io/ioutil" "net/http" "net/http/httptest" ) func myFunc(client *http.Client, url1 string) string { url2 := get(client, url1) return get(client, url2) } func get(client *http.Client, url string) string { resp, err := client.Get(url) if err != nil { fmt.Println(err) } body, err := ioutil.ReadAll(resp.Body) defer resp.Body.Close() if err != nil { fmt.Println(err) } return string(body) } // test myFunc func main() { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.String() { case "/url1": w.Write([]byte("/url2")) // how to specify srv.URL+"/url2" here? case "/url2": w.Write([]byte("return data")) } })) defer srv.Close() myFunc(srv.Client(), srv.URL+"/url1") }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue