Last active
August 29, 2015 14:03
-
-
Save iandelahorne/9a58fa216262d5f2a245 to your computer and use it in GitHub Desktop.
Testing gophercloud.ServerById
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
: ian@Upshot-Knothole go; ./serverbyid | |
Got JSON body {"itemNotFound": {"message": "Instance could not be found", "code": 404}} | |
panic: runtime error: invalid memory address or nil pointer dereference | |
[signal 0xb code=0x1 addr=0x0 pc=0x304f2] | |
goroutine 16 [running]: | |
runtime.panic(0x2aa680, 0x46e8e4) | |
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5 | |
github.com/rackspace/gophercloud.(*genericServersProvider).ServerById(0xc2081de7b0, 0x2ee450, 0x8, 0x15, 0x0, 0x0) | |
/Users/ian/go/src/github.com/rackspace/gophercloud/servers.go:103 +0x252 | |
main.main() | |
/Users/ian/go/serverbyid.go:36 +0x3e2 | |
goroutine 19 [finalizer wait]: | |
runtime.park(0x148f0, 0x471eb0, 0x4709a9) | |
/usr/local/go/src/pkg/runtime/proc.c:1369 +0x89 | |
runtime.parkunlock(0x471eb0, 0x4709a9) | |
/usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b | |
runfinq() | |
/usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 24 [IO wait]: | |
net.runtime_pollWait(0x51e700, 0x72, 0x0) | |
/private/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/makerelease530016500/go/src/pkg/runtime/netpoll.goc:146 +0x66 | |
net.(*pollDesc).Wait(0xc20802a290, 0x72, 0x0, 0x0) | |
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46 | |
net.(*pollDesc).WaitRead(0xc20802a290, 0x0, 0x0) | |
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42 | |
net.(*netFD).Read(0xc20802a230, 0xc208098000, 0x1000, 0x1000, 0x0, 0x51d418, 0x23) | |
/usr/local/go/src/pkg/net/fd_unix.go:232 +0x34c | |
net.(*conn).Read(0xc208034058, 0xc208098000, 0x1000, 0x1000, 0x0, 0x0, 0x0) | |
/usr/local/go/src/pkg/net/net.go:122 +0xe7 | |
crypto/tls.(*block).readFromUntil(0xc208022c00, 0x51e828, 0xc208034058, 0x5, 0x0, 0x0) | |
/usr/local/go/src/pkg/crypto/tls/conn.go:451 +0xd9 | |
crypto/tls.(*Conn).readRecord(0xc20808e000, 0x17, 0x0, 0x0) | |
/usr/local/go/src/pkg/crypto/tls/conn.go:536 +0x1ff | |
crypto/tls.(*Conn).Read(0xc20808e000, 0xc20809b000, 0x1000, 0x1000, 0x0, 0x0, 0x0) | |
/usr/local/go/src/pkg/crypto/tls/conn.go:901 +0x16a | |
net/http.noteEOFReader.Read(0x5274c0, 0xc20808e000, 0xc2080381b8, 0xc20809b000, 0x1000, 0x1000, 0x483d00, 0x0, 0x0) | |
/usr/local/go/src/pkg/net/http/transport.go:1203 +0x72 | |
net/http.(*noteEOFReader).Read(0xc208280fe0, 0xc20809b000, 0x1000, 0x1000, 0xc20804e050, 0x0, 0x0) | |
<autogenerated>:124 +0xca | |
bufio.(*Reader).fill(0xc20821cea0) | |
/usr/local/go/src/pkg/bufio/bufio.go:97 +0x1b3 | |
bufio.(*Reader).Peek(0xc20821cea0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0) | |
/usr/local/go/src/pkg/bufio/bufio.go:132 +0x101 | |
net/http.(*persistConn).readLoop(0xc208038160) | |
/usr/local/go/src/pkg/net/http/transport.go:782 +0x95 | |
created by net/http.(*Transport).dialConn | |
/usr/local/go/src/pkg/net/http/transport.go:600 +0x93f | |
goroutine 17 [syscall]: | |
runtime.goexit() | |
/usr/local/go/src/pkg/runtime/proc.c:1445 | |
goroutine 25 [select]: | |
net/http.(*persistConn).writeLoop(0xc208038160) | |
/usr/local/go/src/pkg/net/http/transport.go:885 +0x38f | |
created by net/http.(*Transport).dialConn | |
/usr/local/go/src/pkg/net/http/transport.go:601 +0x957 | |
goroutine 29 [runnable]: | |
net/http.(*persistConn).readLoop(0xc2081fbad0) | |
/usr/local/go/src/pkg/net/http/transport.go:868 +0x829 | |
created by net/http.(*Transport).dialConn | |
/usr/local/go/src/pkg/net/http/transport.go:600 +0x93f | |
goroutine 30 [select]: | |
net/http.(*persistConn).writeLoop(0xc2081fbad0) | |
/usr/local/go/src/pkg/net/http/transport.go:885 +0x38f | |
created by net/http.(*Transport).dialConn | |
/usr/local/go/src/pkg/net/http/transport.go:601 +0x957 | |
: ian@Upshot-Knothole go; |
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 ( | |
"github.com/rackspace/gophercloud" | |
"log" | |
) | |
func main() { | |
authoptions := gophercloud.AuthOptions{ | |
AllowReauth: true, | |
ApiKey: "APIKEY", | |
Username: "USERNAME", | |
Password: "APIKEY", | |
} | |
auth, err := gophercloud.Authenticate("rackspace-us", authoptions) | |
if err != nil { | |
log.Printf("Authenticate err %+v", err) | |
return | |
} | |
api, err := gophercloud.PopulateApi("rackspace") | |
if err != nil { | |
log.Printf("PopulateApi err %+v", err) | |
return | |
} | |
api.Region = "DFW" | |
csp, err := gophercloud.ServersApi(auth, api) | |
if err != nil { | |
log.Printf("ServersApi err %+v\n", err) | |
return | |
} | |
_, err = csp.ServerById("BAD-UUID") | |
if err != nil { | |
log.Printf("ServerById error: %s", err) | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment