From 0cedf9b7d49a00f4b4ae7f3d4cafcb87746b23f8 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Wed, 10 Oct 2012 15:33:53 -0700 Subject: [PATCH] we can just use %x here (thanks @rob_pike). --- examples/sha1-hashes/sha1-hashes.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/sha1-hashes/sha1-hashes.go b/examples/sha1-hashes/sha1-hashes.go index bf753eb..9da8d68 100644 --- a/examples/sha1-hashes/sha1-hashes.go +++ b/examples/sha1-hashes/sha1-hashes.go @@ -10,7 +10,6 @@ package main // Go implements several hash functions in various // `crypto/*` packages. import "crypto/sha1" -import "encoding/hex" import "fmt" func main() { @@ -31,8 +30,8 @@ func main() { bs := h.Sum(nil) // SHA1 values are often printed in hex, for example - // in git commits. Use `hex.EncodeToString` to convert + // in git commits. Use the `%x` format verb to convert // a hash results to a hex string. fmt.Println(s) - fmt.Println(hex.EncodeToString(bs)) + fmt.Printf("%x\n", bs) }