-From 4c1f8a36696db8cc34663b1e518fa10be5bafbba Mon Sep 17 00:00:00 2001
+From 9279d4856948f1f176c444c44722e520ebe78efc Mon Sep 17 00:00:00 2001
 From: Paladetch Usavasereelert <paladetch.u@gmail.com>
-Date: Sat, 14 Jan 2017 13:42:50 +0900
-Subject: [PATCH] Add filter and fix annotation
+Date: Fri, 24 Feb 2017 13:17:10 +0900
+Subject: [PATCH] Patch for latest go1 branch
 
 ---
- amqp/message.go        | 16 +++++++++++++++-
+ amqp/message.go        | 19 ++++++++++++++++++-
  electron/link.go       |  5 +++++
- proton/wrappers_gen.go | 17 +++++++++++++++++
- 3 files changed, 37 insertions(+), 1 deletion(-)
+ proton/wrappers_gen.go | 20 ++++++++++++++++++++
+ 3 files changed, 43 insertions(+), 1 deletion(-)
 
 diff --git a/amqp/message.go b/amqp/message.go
-index 753682e..2b0a281 100644
+index 753682e..4f9c33c 100644
 --- a/amqp/message.go
 +++ b/amqp/message.go
-@@ -302,7 +302,21 @@ func (m *message) SetReplyToGroupId(s string) {
+@@ -302,7 +302,24 @@ func (m *message) SetReplyToGroupId(s string) {
  func (m *message) SetInstructions(v map[string]interface{}) {
  	setData(v, C.pn_message_instructions(m.pn))
  }
 -func (m *message) SetAnnotations(v map[string]interface{}) { setData(v, C.pn_message_annotations(m.pn)) }
++
 +func (m *message) SetAnnotations(v map[string]interface{}) {
 +	d := C.pn_message_annotations(m.pn)
 +	for k, v := range v {

+	}
+	return bool(C.pn_data_exit(d.pn));
+}
 func (t Terminus) SetDistributionMode(mode DistributionMode) int {
 	return int(C.pn_terminus_set_distribution_mode(t.pn, C.pn_distribution_mode_t(mode)))
 }
-- 
2.10.1 (Apple Git-78)


+	}
+	C.pn_data_exit(d)
+}
+
+
 func (m *message) SetProperties(v map[string]interface{})  { setData(v, C.pn_message_properties(m.pn)) }
 
 // Marshal/Unmarshal body
diff --git a/electron/link.go b/electron/link.go
index 4f927c1..9f6e11c 100644
--- a/electron/link.go
+++ b/electron/link.go
@@ -83,6 +83,9 @@ func Capacity(n int) LinkOption { return func(l *linkSettings) { l.capacity = n
 // Prefetch returns a LinkOption that sets a receivers pre-fetch flag. Not relevant for a sender.
 func Prefetch(p bool) LinkOption { return func(l *linkSettings) { l.prefetch = p } }
 
+// Filter returns a LinkOption that sets a filter.
+func Filter(m map[string]string) LinkOption { return func(l *linkSettings) { l.filter = m } }
+
 // DurableSubscription returns a LinkOption that configures a Receiver as a named durable
 // subscription.  The name overrides (and is overridden by) LinkName() so you should normally
 // only use one of these options.
@@ -161,6 +164,7 @@ type linkSettings struct {
 	rcvSettle      RcvSettleMode
 	capacity       int
 	prefetch       bool
+	filter	       map[string]string
 	session        *session
 	pLink          proton.Link
 }
@@ -227,6 +231,7 @@ func makeLocalLink(sn *session, isSender bool, setting ...LinkOption) (linkSetti
 		return l, fmt.Errorf("cannot create link %s", l.pLink)
 	}
 	l.pLink.Source().SetAddress(l.source)
+	l.pLink.Source().SetFilter(l.filter)
 	l.pLink.Source().SetDurability(l.sourceSettings.Durability)
 	l.pLink.Source().SetExpiryPolicy(l.sourceSettings.Expiry)
 	l.pLink.Source().SetTimeout(l.sourceSettings.Timeout)
diff --git a/proton/wrappers_gen.go b/proton/wrappers_gen.go
index 0db04c8..337720c 100644
--- a/proton/wrappers_gen.go
+++ b/proton/wrappers_gen.go
@@ -613,6 +613,26 @@ func (t Terminus) SetAddress(address string) int {
 
 	return int(C.pn_terminus_set_address(t.pn, addressC))
 }
+
+func (t Terminus) SetFilter(filter map[string]string) bool {
+	d := Data{C.pn_terminus_filter(t.pn)}
+	for k, v := range filter {
