From 9bf6eec1a51c49f025454fdfc709b4d29142f84c Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 9 May 2012 13:15:18 +0200 Subject: [PATCH] go: update the addrlookup utility to go 1 Use the new built in error type that replaces os.Error, adapt the code to the fact that strings.Split has just two arguments now. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- bindings/go/src/notmuch-addrlookup/addrlookup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/go/src/notmuch-addrlookup/addrlookup.go b/bindings/go/src/notmuch-addrlookup/addrlookup.go index 03699fb4..d1726666 100644 --- a/bindings/go/src/notmuch-addrlookup/addrlookup.go +++ b/bindings/go/src/notmuch-addrlookup/addrlookup.go @@ -86,7 +86,7 @@ func addresses_by_frequency(msgs *notmuch.Messages, name string, pass uint, addr // "\\b\\w+([-+.]\\w+)*\\@\\w+[-\\.\\w]*\\.([-\\.\\w]+)*\\w\\b)>?)" pattern = `.*` + strings.ToLower(name) + `.*` var re *regexp.Regexp = nil - var err os.Error = nil + var err error = nil if re,err = regexp.Compile(pattern); err != nil { log.Printf("error: %v\n", err) return &freqs @@ -103,7 +103,7 @@ func addresses_by_frequency(msgs *notmuch.Messages, name string, pass uint, addr for _,header := range headers { froms := strings.ToLower(msg.GetHeader(header)) //println(" froms: ["+froms+"]") - for _,from := range strings.Split(froms, ",", -1) { + for _,from := range strings.Split(froms, ",") { from = strings.Trim(from, " ") match := re.FindString(from) //println(" -> match: ["+match+"]") @@ -179,7 +179,7 @@ type address_matcher struct { func new_address_matcher() *address_matcher { var cfg *config.Config - var err os.Error + var err error // honor NOTMUCH_CONFIG home := os.Getenv("NOTMUCH_CONFIG")