Created
October 2, 2012 21:06
-
-
Save kierdavis/3823314 to your computer and use it in GitHub Desktop.
Sample code for "use of closed network connection" error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) | |
const TheURL = "http://repo.bukkit.org/service/local/repositories/legacy/content/org/bukkit/bukkit/1.9-pre5-R1-SNAPSHOT/bukkit-1.9-pre5-R1-20111122.004050-46.jar" | |
func main() { | |
resp, err := http.Get(TheURL) | |
if err != nil { | |
log.Fatal(err) | |
} | |
// Dump the response | |
fmt.Printf("%#v\n", resp) | |
_, err = ioutil.ReadAll(resp.Body) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment