From 4aa87defd24c400cd87a09ae5e71277dec64f4e7 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 27 Mar 2020 07:49:38 +0000 Subject: [PATCH 1/3] fix var lengths with v0.27 --- go/genwrap.go | 12 ++++----- go/src/qpid.apache.org/amqp/version.go | 2 +- go/src/qpid.apache.org/proton/wrappers_gen.go | 26 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/go/genwrap.go b/go/genwrap.go index b7cd6c0971..54d51c19e3 100644 --- a/go/genwrap.go +++ b/go/genwrap.go @@ -94,10 +94,10 @@ package amqp // #include // #if PN_VERSION_MAJOR == %s && PN_VERSION_MINOR < %s -// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater +// #error packages qpid.apache.org/... require Proton-C library version %s.%s or greater // #endif import "C" -`, splitVersion[0], splitVersion[1]) +`, splitVersion[0], splitVersion[1], splitVersion[0], splitVersion[1]) } func genWrappers() { @@ -352,15 +352,15 @@ func mapType(ctype string) (g genType) { case "C.int64_t": g.Gotype = "int64" case "C.int32_t": - g.Gotype = "int16" - case "C.int16_t": g.Gotype = "int32" + case "C.int16_t": + g.Gotype = "int16" case "C.uint64_t": g.Gotype = "uint64" case "C.uint32_t": - g.Gotype = "uint16" - case "C.uint16_t": g.Gotype = "uint32" + case "C.uint16_t": + g.Gotype = "uint16" case "C.const char *": fallthrough case "C.char *": diff --git a/go/src/qpid.apache.org/amqp/version.go b/go/src/qpid.apache.org/amqp/version.go index 31d69d2f25..8178250a3a 100644 --- a/go/src/qpid.apache.org/amqp/version.go +++ b/go/src/qpid.apache.org/amqp/version.go @@ -30,6 +30,6 @@ package amqp // #include // #if PN_VERSION_MAJOR == 0 && PN_VERSION_MINOR < 27 -// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater +// #error packages qpid.apache.org/... require Proton-C library version 0.27 or greater // #endif import "C" diff --git a/go/src/qpid.apache.org/proton/wrappers_gen.go b/go/src/qpid.apache.org/proton/wrappers_gen.go index a627e60f8f..b77139d1d2 100644 --- a/go/src/qpid.apache.org/proton/wrappers_gen.go +++ b/go/src/qpid.apache.org/proton/wrappers_gen.go @@ -467,10 +467,10 @@ func (d Disposition) Condition() Condition { func (d Disposition) Data() Data { return Data{C.pn_disposition_data(d.pn)} } -func (d Disposition) SectionNumber() uint16 { - return uint16(C.pn_disposition_get_section_number(d.pn)) +func (d Disposition) SectionNumber() uint32 { + return uint32(C.pn_disposition_get_section_number(d.pn)) } -func (d Disposition) SetSectionNumber(section_number uint16) { +func (d Disposition) SetSectionNumber(section_number uint32) { C.pn_disposition_set_section_number(d.pn, C.uint32_t(section_number)) } func (d Disposition) SectionOffset() uint64 { @@ -828,23 +828,23 @@ func (t Transport) Log(message string) { C.pn_transport_log(t.pn, messageC) } -func (t Transport) ChannelMax() uint32 { - return uint32(C.pn_transport_get_channel_max(t.pn)) +func (t Transport) ChannelMax() uint16 { + return uint16(C.pn_transport_get_channel_max(t.pn)) } -func (t Transport) SetChannelMax(channel_max uint32) int { +func (t Transport) SetChannelMax(channel_max uint16) int { return int(C.pn_transport_set_channel_max(t.pn, C.uint16_t(channel_max))) } -func (t Transport) RemoteChannelMax() uint32 { - return uint32(C.pn_transport_remote_channel_max(t.pn)) +func (t Transport) RemoteChannelMax() uint16 { + return uint16(C.pn_transport_remote_channel_max(t.pn)) } -func (t Transport) MaxFrame() uint16 { - return uint16(C.pn_transport_get_max_frame(t.pn)) +func (t Transport) MaxFrame() uint32 { + return uint32(C.pn_transport_get_max_frame(t.pn)) } -func (t Transport) SetMaxFrame(size uint16) { +func (t Transport) SetMaxFrame(size uint32) { C.pn_transport_set_max_frame(t.pn, C.uint32_t(size)) } -func (t Transport) RemoteMaxFrame() uint16 { - return uint16(C.pn_transport_get_remote_max_frame(t.pn)) +func (t Transport) RemoteMaxFrame() uint32 { + return uint32(C.pn_transport_get_remote_max_frame(t.pn)) } func (t Transport) IdleTimeout() time.Duration { return (time.Duration(C.pn_transport_get_idle_timeout(t.pn)) * time.Millisecond) From 57592b9510080d4c0fb7bb0842733166e37630fc Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 27 Mar 2020 08:27:32 +0000 Subject: [PATCH 2/3] update parseURL expected output because parse error format has changed --- go/pkg/amqp/url_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/pkg/amqp/url_test.go b/go/pkg/amqp/url_test.go index 192e2fb04e..c13a8b57bc 100644 --- a/go/pkg/amqp/url_test.go +++ b/go/pkg/amqp/url_test.go @@ -32,8 +32,9 @@ func ExampleParseURL() { "amqps://host", "/path", "", - ":1234", - // Taken out because the go 1.4 URL parser isn't the same as later + // Taken out because url.Parse error formatting changed in 1.13 + // ":1234", + // Taken out because the go 1.4 URL parser isn't the same as later //"[::1]", //"[::1", // Output would be: @@ -55,5 +56,4 @@ func ExampleParseURL() { // amqps://host:amqps // amqp://localhost:amqp/path // amqp://localhost:amqp - // parse :1234: missing protocol scheme } From 698071a2a942c6d7d09145941ba55b60b18bfe3b Mon Sep 17 00:00:00 2001 From: d98762625 Date: Fri, 27 Mar 2020 11:29:17 +0000 Subject: [PATCH 3/3] revert comment changes regarding version because it still works with 0.10 --- go/genwrap.go | 4 ++-- go/pkg/amqp/version.go | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/go/genwrap.go b/go/genwrap.go index 7230899364..27a5f7e6d4 100644 --- a/go/genwrap.go +++ b/go/genwrap.go @@ -94,10 +94,10 @@ package amqp // #include // #if PN_VERSION_MAJOR == %s && PN_VERSION_MINOR < %s -// #error packages qpid.apache.org/... require Proton-C library version %s.%s or greater +// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater // #endif import "C" -`, splitVersion[0], splitVersion[1], splitVersion[0], splitVersion[1]) +`, splitVersion[0], splitVersion[1]) } func genWrappers() { diff --git a/go/pkg/amqp/version.go b/go/pkg/amqp/version.go index d23b90ea89..31d69d2f25 100644 --- a/go/pkg/amqp/version.go +++ b/go/pkg/amqp/version.go @@ -22,16 +22,14 @@ under the License. // Update the generator and re-run if you need to modify this code. // + package amqp -// Version check for compatible proton-c library. -// -// NOTE: the required version should NOT be increased unless the Go -// library is modified to require some new proton-c API. That hasn't -// happened for a long time. +// Version check for proton library. +// Done here because this is the lowest-level dependency for all the proton Go packages. // #include // #if PN_VERSION_MAJOR == 0 && PN_VERSION_MINOR < 27 -// #error packages qpid.apache.org/... require Proton-C library version 0.27 or greater +// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater // #endif import "C"