Skip to content

Instantly share code, notes, and snippets.

@serialhex
Created June 30, 2011 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serialhex/1057066 to your computer and use it in GitHub Desktop.
Save serialhex/1057066 to your computer and use it in GitHub Desktop.
// more code above & below
/* the following gives me this run-time error:
###
panic: runtime error: index out of range
runtime.panic+0xa4 /home/serialhex/src/go/src/pkg/runtime/proc.c:1060
runtime.panic(0x80992f0, 0x977473f8)
runtime.panicstring+0x95 /home/serialhex/src/go/src/pkg/runtime/runtime.c:116
runtime.panicstring(0x80f0766, 0x8)
runtime.panicindex+0x27 /home/serialhex/src/go/src/pkg/runtime/runtime.c:73
runtime.panicindex()
main.main+0x7d /home/serialhex/src/serialhex/challenges/causes_problem/social_distance.go:51
main.main()
runtime.mainstart+0xf /home/serialhex/src/go/src/pkg/runtime/386/asm.s:93
runtime.mainstart()
runtime.goexit /home/serialhex/src/go/src/pkg/runtime/proc.c:178
runtime.goexit()
----- goroutine created by -----
_rt0_386+0xc1 /home/serialhex/src/go/src/pkg/runtime/386/asm.s:80
###
and yes, the first assignment to the slice is at line 51 in the code,
WTF am i doing wrong? (or do i need to do????)
*/
// will initialize dict here...
dict := make([]string, 0)
dict[0] = "foo"
dict[1] = "fox" // ed - foo: 1
dict[2] = "rox" // ed - fox: 1, foo: 2
dict[3] = "qwerty" // ed - all: 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment