Last active
April 22, 2016 17:56
-
-
Save btoews/e500ea0ff320fc4049f8c598ab426118 to your computer and use it in GitHub Desktop.
error demo
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 ( | |
"crypto/sha256" | |
"fmt" | |
"hash" | |
) | |
type Signer struct { | |
hash.Hash | |
} | |
func (s Signer) InitHash() { | |
s.Hash = sha256.New() | |
} | |
func main() { | |
s := new(Signer) | |
s.InitHash() | |
digest := s.Sum([]byte("hello world")) | |
fmt.Printf("digest: %x\n", digest) | |
} |
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
Benjamins-MacBook-Pro:test mastahyeti$ go run ./foo.go | |
panic: runtime error: invalid memory address or nil pointer dereference | |
[signal 0xb code=0x1 addr=0x38 pc=0x2139] | |
goroutine 1 [running]: | |
panic(0xdf700, 0xc82000a0c0) | |
/usr/local/Cellar/go/1.6.1/libexec/src/runtime/panic.go:464 +0x3e6 | |
main.main() | |
/Users/mastahyeti/Projects/go/src/test/foo.go:21 +0xc9 | |
exit status 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment