Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 3f / 65b3e5143286e6ab16725c6f4e01dd1a6a3b9a
1 Return-Path: <teythoon@jade-hamburg.de>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id EE9E1431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 08:14:06 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 6sPTcqQKYg+j for <notmuch@notmuchmail.org>;\r
16         Tue, 23 Apr 2013 08:14:05 -0700 (PDT)\r
17 Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
18         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id E1AFA431FAE\r
21         for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 08:14:04 -0700 (PDT)\r
22 Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228])\r
23         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
24         (No client certificate requested)\r
25         by mail.cryptobitch.de (Postfix) with ESMTPSA id 760BA629E61\r
26         for <notmuch@notmuchmail.org>; Tue, 23 Apr 2013 17:13:57 +0200 (CEST)\r
27 Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
28         id D538CDF29F; Tue, 23 Apr 2013 17:13:56 +0200 (CEST)\r
29 Received: from thinkbox.jade-hamburg.de (cryptobitch.de [88.198.7.68])\r
30         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
31         (No client certificate requested) (Authenticated sender: teythoon)\r
32         by mail.jade-hamburg.de (Postfix) with ESMTPSA id 84EA4DF29F;\r
33         Tue, 23 Apr 2013 17:13:54 +0200 (CEST)\r
34 Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80)\r
35         (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
36         id 1UUeun-0004Rb-6K; Tue, 23 Apr 2013 17:13:53 +0200\r
37 From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH] go: use a different goconfig package\r
40 Date: Tue, 23 Apr 2013 17:13:07 +0200\r
41 Message-Id:\r
42  <1366729987-16925-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Tue, 23 Apr 2013 15:14:07 -0000\r
57 \r
58 The notmuch-addrlookup utility uses a third party library to read the\r
59 notmuch configuration file. The previously used implementation at\r
60 "github.com/kless/goconfig" vanished, so this patch switches to the\r
61 implementation at "github.com/msbranco/goconfig". As the\r
62 implementations differ at the API level, the code is updated\r
63 accordingly.\r
64 \r
65 Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>\r
66 ---\r
67  bindings/go/Makefile                             |    4 ++--\r
68  bindings/go/src/notmuch-addrlookup/addrlookup.go |   14 ++++++--------\r
69  2 files changed, 8 insertions(+), 10 deletions(-)\r
70 \r
71 diff --git a/bindings/go/Makefile b/bindings/go/Makefile\r
72 index c38f234..1b9e750 100644\r
73 --- a/bindings/go/Makefile\r
74 +++ b/bindings/go/Makefile\r
75 @@ -15,8 +15,8 @@ notmuch:\r
76  \r
77  .PHONY: goconfig\r
78  goconfig:\r
79 -       if [ ! -d src/github.com/kless/goconfig/config ]; then \\r
80 -           $(GO) get github.com/kless/goconfig/config; \\r
81 +       if [ ! -d github.com/msbranco/goconfig ]; then \\r
82 +           $(GO) get github.com/msbranco/goconfig; \\r
83         fi\r
84  \r
85  .PHONY: notmuch-addrlookup\r
86 diff --git a/bindings/go/src/notmuch-addrlookup/addrlookup.go b/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
87 index 59283f8..916e5bb 100644\r
88 --- a/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
89 +++ b/bindings/go/src/notmuch-addrlookup/addrlookup.go\r
90 @@ -11,7 +11,7 @@ import "sort"\r
91  \r
92  // 3rd-party imports\r
93  import "notmuch"\r
94 -import "github.com/kless/goconfig/config"\r
95 +import "github.com/msbranco/goconfig"\r
96  \r
97  type mail_addr_freq struct {\r
98         addr  string\r
99 @@ -178,22 +178,20 @@ type address_matcher struct {\r
100  }\r
101  \r
102  func new_address_matcher() *address_matcher {\r
103 -       var cfg *config.Config\r
104 -       var err error\r
105 -\r
106         // honor NOTMUCH_CONFIG\r
107         home := os.Getenv("NOTMUCH_CONFIG")\r
108         if home == "" {\r
109                 home = os.Getenv("HOME")\r
110         }\r
111  \r
112 -       if cfg, err = config.ReadDefault(path.Join(home, ".notmuch-config")); err != nil {\r
113 +       cfg, err := goconfig.ReadConfigFile(path.Join(home, ".notmuch-config"))\r
114 +       if err != nil {\r
115                 log.Fatalf("error loading config file:", err)\r
116         }\r
117  \r
118 -       db_path, _ := cfg.String("database", "path")\r
119 -       primary_email, _ := cfg.String("user", "primary_email")\r
120 -       addrbook_tag, err := cfg.String("user", "addrbook_tag")\r
121 +       db_path, _ := cfg.GetString("database", "path")\r
122 +       primary_email, _ := cfg.GetString("user", "primary_email")\r
123 +       addrbook_tag, err := cfg.GetString("user", "addrbook_tag")\r
124         if err != nil {\r
125                 addrbook_tag = "addressbook"\r
126         }\r
127 -- \r
128 1.7.10.4\r
129 \r