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 EE9E1431FAF for ; Tue, 23 Apr 2013 08:14:06 -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 6sPTcqQKYg+j for ; Tue, 23 Apr 2013 08:14:05 -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 E1AFA431FAE for ; Tue, 23 Apr 2013 08:14:04 -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 760BA629E61 for ; Tue, 23 Apr 2013 17:13:57 +0200 (CEST) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id D538CDF29F; Tue, 23 Apr 2013 17:13:56 +0200 (CEST) Received: from thinkbox.jade-hamburg.de (cryptobitch.de [88.198.7.68]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: teythoon) by mail.jade-hamburg.de (Postfix) with ESMTPSA id 84EA4DF29F; Tue, 23 Apr 2013 17:13:54 +0200 (CEST) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80) (envelope-from ) id 1UUeun-0004Rb-6K; Tue, 23 Apr 2013 17:13:53 +0200 From: Justus Winter <4winter@informatik.uni-hamburg.de> To: notmuch@notmuchmail.org Subject: [PATCH] go: use a different goconfig package Date: Tue, 23 Apr 2013 17:13:07 +0200 Message-Id: <1366729987-16925-1-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailer: git-send-email 1.7.10.4 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: Tue, 23 Apr 2013 15:14:07 -0000 The notmuch-addrlookup utility uses a third party library to read the notmuch configuration file. The previously used implementation at "github.com/kless/goconfig" vanished, so this patch switches to the implementation at "github.com/msbranco/goconfig". As the implementations differ at the API level, the code is updated accordingly. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> --- bindings/go/Makefile | 4 ++-- bindings/go/src/notmuch-addrlookup/addrlookup.go | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bindings/go/Makefile b/bindings/go/Makefile index c38f234..1b9e750 100644 --- a/bindings/go/Makefile +++ b/bindings/go/Makefile @@ -15,8 +15,8 @@ notmuch: .PHONY: goconfig goconfig: - if [ ! -d src/github.com/kless/goconfig/config ]; then \ - $(GO) get github.com/kless/goconfig/config; \ + if [ ! -d github.com/msbranco/goconfig ]; then \ + $(GO) get github.com/msbranco/goconfig; \ fi .PHONY: notmuch-addrlookup diff --git a/bindings/go/src/notmuch-addrlookup/addrlookup.go b/bindings/go/src/notmuch-addrlookup/addrlookup.go index 59283f8..916e5bb 100644 --- a/bindings/go/src/notmuch-addrlookup/addrlookup.go +++ b/bindings/go/src/notmuch-addrlookup/addrlookup.go @@ -11,7 +11,7 @@ import "sort" // 3rd-party imports import "notmuch" -import "github.com/kless/goconfig/config" +import "github.com/msbranco/goconfig" type mail_addr_freq struct { addr string @@ -178,22 +178,20 @@ type address_matcher struct { } func new_address_matcher() *address_matcher { - var cfg *config.Config - var err error - // honor NOTMUCH_CONFIG home := os.Getenv("NOTMUCH_CONFIG") if home == "" { home = os.Getenv("HOME") } - if cfg, err = config.ReadDefault(path.Join(home, ".notmuch-config")); err != nil { + cfg, err := goconfig.ReadConfigFile(path.Join(home, ".notmuch-config")) + if err != nil { log.Fatalf("error loading config file:", err) } - db_path, _ := cfg.String("database", "path") - primary_email, _ := cfg.String("user", "primary_email") - addrbook_tag, err := cfg.String("user", "addrbook_tag") + db_path, _ := cfg.GetString("database", "path") + primary_email, _ := cfg.GetString("user", "primary_email") + addrbook_tag, err := cfg.GetString("user", "addrbook_tag") if err != nil { addrbook_tag = "addressbook" } -- 1.7.10.4