[PATCH] go: use a different goconfig package
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Tue, 23 Apr 2013 15:13:07 +0000 (17:13 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:26 +0000 (09:54 -0800)
3f/65b3e5143286e6ab16725c6f4e01dd1a6a3b9a [new file with mode: 0644]

diff --git a/3f/65b3e5143286e6ab16725c6f4e01dd1a6a3b9a b/3f/65b3e5143286e6ab16725c6f4e01dd1a6a3b9a
new file mode 100644 (file)
index 0000000..20e3c88
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <teythoon@jade-hamburg.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EE9E1431FAF\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 08:14:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 6sPTcqQKYg+j for <notmuch@notmuchmail.org>;\r
+       Tue, 23 Apr 2013 08:14:05 -0700 (PDT)\r
+Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E1AFA431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 08:14:04 -0700 (PDT)\r
+Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by mail.cryptobitch.de (Postfix) with ESMTPSA id 760BA629E61\r
+       for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 17:13:57 +0200 (CEST)\r
+Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
+       id D538CDF29F; Tue, 23 Apr 2013 17:13:56 +0200 (CEST)\r
+Received: from thinkbox.jade-hamburg.de (cryptobitch.de [88.198.7.68])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested) (Authenticated sender: teythoon)\r
+       by mail.jade-hamburg.de (Postfix) with ESMTPSA id 84EA4DF29F;\r
+       Tue, 23 Apr 2013 17:13:54 +0200 (CEST)\r
+Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80)\r
+       (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
+       id 1UUeun-0004Rb-6K; Tue, 23 Apr 2013 17:13:53 +0200\r
+From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] go: use a different goconfig package\r
+Date: Tue, 23 Apr 2013 17:13:07 +0200\r
+Message-Id:\r
+ <1366729987-16925-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 23 Apr 2013 15:14:07 -0000\r
+\r
+The notmuch-addrlookup utility uses a third party library to read the\r
+notmuch configuration file. The previously used implementation at\r
+"github.com/kless/goconfig" vanished, so this patch switches to the\r
+implementation at "github.com/msbranco/goconfig". As the\r
+implementations differ at the API level, the code is updated\r
+accordingly.\r
+\r
+Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+---\r
+ bindings/go/Makefile                             |    4 ++--\r
+ bindings/go/src/notmuch-addrlookup/addrlookup.go |   14 ++++++--------\r
+ 2 files changed, 8 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/bindings/go/Makefile b/bindings/go/Makefile\r
+index c38f234..1b9e750 100644\r
+--- a/bindings/go/Makefile\r
++++ b/bindings/go/Makefile\r
+@@ -15,8 +15,8 @@ notmuch:\r
\r
+ .PHONY: goconfig\r
+ goconfig:\r
+-      if [ ! -d src/github.com/kless/goconfig/config ]; then \\r
+-          $(GO) get github.com/kless/goconfig/config; \\r
++      if [ ! -d github.com/msbranco/goconfig ]; then \\r
++          $(GO) get github.com/msbranco/goconfig; \\r
+       fi\r
\r
+ .PHONY: notmuch-addrlookup\r
+diff --git a/bindings/go/src/notmuch-addrlookup/addrlookup.go b/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
+index 59283f8..916e5bb 100644\r
+--- a/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
++++ b/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
+@@ -11,7 +11,7 @@ import "sort"\r
\r
+ // 3rd-party imports\r
+ import "notmuch"\r
+-import "github.com/kless/goconfig/config"\r
++import "github.com/msbranco/goconfig"\r
\r
+ type mail_addr_freq struct {\r
+       addr  string\r
+@@ -178,22 +178,20 @@ type address_matcher struct {\r
+ }\r
\r
+ func new_address_matcher() *address_matcher {\r
+-      var cfg *config.Config\r
+-      var err error\r
+-\r
+       // honor NOTMUCH_CONFIG\r
+       home := os.Getenv("NOTMUCH_CONFIG")\r
+       if home == "" {\r
+               home = os.Getenv("HOME")\r
+       }\r
\r
+-      if cfg, err = config.ReadDefault(path.Join(home, ".notmuch-config")); err != nil {\r
++      cfg, err := goconfig.ReadConfigFile(path.Join(home, ".notmuch-config"))\r
++      if err != nil {\r
+               log.Fatalf("error loading config file:", err)\r
+       }\r
\r
+-      db_path, _ := cfg.String("database", "path")\r
+-      primary_email, _ := cfg.String("user", "primary_email")\r
+-      addrbook_tag, err := cfg.String("user", "addrbook_tag")\r
++      db_path, _ := cfg.GetString("database", "path")\r
++      primary_email, _ := cfg.GetString("user", "primary_email")\r
++      addrbook_tag, err := cfg.GetString("user", "addrbook_tag")\r
+       if err != nil {\r
+               addrbook_tag = "addressbook"\r
+       }\r
+-- \r
+1.7.10.4\r
+\r