From 44539c43b35be2ddf542ce86c6abb449f80091ce 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] [PATCH 3/5] go: update the addrlookup utility to go 1 --- bb/090203492313041b8888bb00e9e858f1ce574b | 103 ++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 bb/090203492313041b8888bb00e9e858f1ce574b diff --git a/bb/090203492313041b8888bb00e9e858f1ce574b b/bb/090203492313041b8888bb00e9e858f1ce574b new file mode 100644 index 000000000..1fb629cba --- /dev/null +++ b/bb/090203492313041b8888bb00e9e858f1ce574b @@ -0,0 +1,103 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 66F22431FC0 + for ; Wed, 9 May 2012 04:15:49 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id sy+ukM2G7d-d for ; + Wed, 9 May 2012 04:15:48 -0700 (PDT) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id BDDD9431FCF + for ; Wed, 9 May 2012 04:15:46 -0700 (PDT) +Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id 64D2E588C23 + for ; Wed, 9 May 2012 13:15:45 +0200 (CEST) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 1D15BDF2A2; Wed, 9 May 2012 13:15:30 +0200 (CEST) +Received: from thinkbox.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id E5CB9DF2A5; + Wed, 9 May 2012 13:15:18 +0200 (CEST) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) + (envelope-from ) + id 1SS4rj-0003cc-3N; Wed, 09 May 2012 13:15:31 +0200 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +To: notmuch@notmuchmail.org +Subject: [PATCH 3/5] go: update the addrlookup utility to go 1 +Date: Wed, 9 May 2012 13:15:18 +0200 +Message-Id: + <1336562120-13837-4-git-send-email-4winter@informatik.uni-hamburg.de> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: + <1336562120-13837-1-git-send-email-4winter@informatik.uni-hamburg.de> +References: <20120505111535.3687.9018@thinkbox.jade-hamburg.de> + <1336562120-13837-1-git-send-email-4winter@informatik.uni-hamburg.de> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 09 May 2012 11:15:49 -0000 + +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 03699fb..d172666 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") +-- +1.7.10 + -- 2.26.2