aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2013-04-23 17:13:07 +0200
committerGravatar David Bremner <bremner@debian.org>2013-05-03 21:21:01 -0300
commit44fe1f2c160eb333732465f051e5110adeab6b0a (patch)
tree613a98f3762cdedd3c6dc7ebcfc411ea607a30c2 /bindings
parent51b073c6f27f4439b2d003df1be1177365e555fe (diff)
go: use a different goconfig package
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>
Diffstat (limited to 'bindings')
-rw-r--r--bindings/go/Makefile4
-rw-r--r--bindings/go/src/notmuch-addrlookup/addrlookup.go14
2 files changed, 8 insertions, 10 deletions
diff --git a/bindings/go/Makefile b/bindings/go/Makefile
index c38f2340..1b9e7505 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 59283f81..916e5bb2 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"
}