unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] go: use a different goconfig package
@ 2013-04-23 15:13 Justus Winter
  2013-04-23 22:51 ` David Bremner
  2013-05-04  0:28 ` David Bremner
  0 siblings, 2 replies; 5+ messages in thread
From: Justus Winter @ 2013-04-23 15:13 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] go: use a different goconfig package
  2013-04-23 15:13 [PATCH] go: use a different goconfig package Justus Winter
@ 2013-04-23 22:51 ` David Bremner
  2013-04-24  9:30   ` Tomi Ollila
  2013-04-24  9:41   ` Justus Winter
  2013-05-04  0:28 ` David Bremner
  1 sibling, 2 replies; 5+ messages in thread
From: David Bremner @ 2013-04-23 22:51 UTC (permalink / raw)
  To: Justus Winter, notmuch

Justus Winter <4winter@informatik.uni-hamburg.de> writes:

> 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.

It's great that you fixed this, but the whole idea of something failing
to build depending on the status of a website makes me pretty
uncomfortable.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] go: use a different goconfig package
  2013-04-23 22:51 ` David Bremner
@ 2013-04-24  9:30   ` Tomi Ollila
  2013-04-24  9:41   ` Justus Winter
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2013-04-24  9:30 UTC (permalink / raw)
  To: David Bremner, Justus Winter, notmuch

On Wed, Apr 24 2013, David Bremner <david@tethera.net> wrote:

> Justus Winter <4winter@informatik.uni-hamburg.de> writes:
>
>> 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.
>
> It's great that you fixed this, but the whole idea of something failing
> to build depending on the status of a website makes me pretty
> uncomfortable.

Me too, but this is the status quo (atm(*)). The patch looks good
and state of things tolerable to me.

(*) and probably things won't change in (near) future ;/

> d

Tomi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] go: use a different goconfig package
  2013-04-23 22:51 ` David Bremner
  2013-04-24  9:30   ` Tomi Ollila
@ 2013-04-24  9:41   ` Justus Winter
  1 sibling, 0 replies; 5+ messages in thread
From: Justus Winter @ 2013-04-24  9:41 UTC (permalink / raw)
  To: David Bremner, notmuch

Quoting David Bremner (2013-04-24 00:51:11)
> Justus Winter <4winter@informatik.uni-hamburg.de> writes:
> 
> > 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.
> 
> It's great that you fixed this, but the whole idea of something failing
> to build depending on the status of a website makes me pretty
> uncomfortable.
> 
> d

Ah, I pondered whether I should write more about the lib change. Maybe
I should have.

So there are two libs, kless and msbranco for short. kless is a fork
of msbranco, and it seems like the author abandoned his fork. So we
are now using the original lib, msbranco. msbranco seems to be in
"maintenance" mode, but has recently received updates to fix some
minor issues wrt. go 1.1. There are a lot of forks of msbranco on
github, so even if msbranco vanishes as well, we can pick the next
most promising fork.

So yeah, I feel the same way, it's unfortunately that I had to patch
this, but we're better of now (it builds again and we moved to a more
"vanilla" goconfig API (assuming the other forks do not change the api
as much as kless did)).

And I think you are being a bit harsh with the "status of the website"
comment. In case you are not familiar with go,
"github.com/kless/goconfig" is a package path, not a website. It just
happens to also be the host+resource part of a URL that points to the
github project page. So what happened here is that the VCS repository
specified by the package path vanished, not some web site (well, that
vanished too, but that didn't cause the build failure). If you happen
to have golang installed, type "go help remote" for more information.

Cheers,
Justus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] go: use a different goconfig package
  2013-04-23 15:13 [PATCH] go: use a different goconfig package Justus Winter
  2013-04-23 22:51 ` David Bremner
@ 2013-05-04  0:28 ` David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: David Bremner @ 2013-05-04  0:28 UTC (permalink / raw)
  To: Justus Winter, notmuch

Justus Winter <4winter@informatik.uni-hamburg.de> writes:

> 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.

Pushed,

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-04  0:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23 15:13 [PATCH] go: use a different goconfig package Justus Winter
2013-04-23 22:51 ` David Bremner
2013-04-24  9:30   ` Tomi Ollila
2013-04-24  9:41   ` Justus Winter
2013-05-04  0:28 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).