You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/11/23 18:58:14 UTC

[46/50] [abbrv] qpid-proton git commit: NO-JIRA: Go: get rid of PN_INVALID constant to work with proton 0.10.

NO-JIRA: Go: get rid of PN_INVALID constant to work with proton 0.10.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1c22210c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1c22210c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1c22210c

Branch: refs/heads/go1
Commit: 1c22210c00715f2362b05d4993c17d275a3be49f
Parents: d43ba0b
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Nov 23 11:07:47 2015 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Nov 23 11:47:10 2015 -0500

----------------------------------------------------------------------
 proton-c/bindings/go/src/qpid.apache.org/amqp/types.go    |  6 +++++-
 .../bindings/go/src/qpid.apache.org/amqp/unmarshal.go     |  6 ++----
 proton-c/bindings/go/src/qpid.apache.org/readme-branch.md |  7 -------
 proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md | 10 +++++++---
 4 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1c22210c/proton-c/bindings/go/src/qpid.apache.org/amqp/types.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/types.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/types.go
index 796da66..abcff25 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/types.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/types.go
@@ -32,6 +32,10 @@ import (
 
 type Type C.pn_type_t
 
+// Older proton versions don't define C.PN_INVALID, so define it here.
+// In C it is pn_type_t(-1), in Go use the bitwise NOT operator to get the same value.
+const pnInvalid = ^C.pn_type_t(0)
+
 func (t Type) String() string {
 	switch C.pn_type_t(t) {
 	case C.PN_NULL:
@@ -85,7 +89,7 @@ func (t Type) String() string {
 	case C.PN_MAP:
 		return "map"
 	default:
-		if uint32(t) == uint32(C.PN_INVALID) {
+		if uint32(t) == uint32(pnInvalid) {
 			return "no-data"
 		}
 		return fmt.Sprintf("unknown-type(%d)", t)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1c22210c/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
index dc658b2..25bb519 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
@@ -451,8 +451,7 @@ func rewindUnmarshal(v interface{}, data *C.pn_data_t) {
 func getInterface(data *C.pn_data_t, v *interface{}) {
 	pnType := C.pn_data_type(data)
 	switch pnType {
-	// Note PN_INVALID is defined outside the enum, older Go versions don't consider it a C.pn_type_t
-	case C.PN_NULL, C.pn_type_t(C.PN_INVALID): // No data.
+	case C.PN_NULL, C.pn_type_t(pnInvalid): // No data.
 		*v = nil
 	case C.PN_BOOL:
 		*v = bool(C.pn_data_get_bool(data))
@@ -518,8 +517,7 @@ func getMap(data *C.pn_data_t, v interface{}) {
 				}
 			}
 		}
-		// Note PN_INVALID is defined outside the enum, older Go versions don't consider it a C.pn_type_t
-	case C.pn_type_t(C.PN_INVALID): // Leave the map empty
+	case C.pn_type_t(pnInvalid): // Leave the map empty
 	default:
 		panic(newUnmarshalError(pnType, v))
 	}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1c22210c/proton-c/bindings/go/src/qpid.apache.org/readme-branch.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/readme-branch.md b/proton-c/bindings/go/src/qpid.apache.org/readme-branch.md
deleted file mode 100644
index b488eea..0000000
--- a/proton-c/bindings/go/src/qpid.apache.org/readme-branch.md
+++ /dev/null
@@ -1,7 +0,0 @@
-`go1` is a special branch for the `go get` command, it contains just the Go subtree of proton.
-
-Created with: `git subtree split --prefix=proton-c/bindings/go/src/qpid.apache.org -b go1`
-Update with:  `git checkout go1; git merge -s subtree master`
-
-To see the branch description: `git config branch.go1.description`
-

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1c22210c/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md b/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
index 7fa9cda..23bc384 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
+++ b/proton-c/bindings/go/src/qpid.apache.org/readme-go-get.md
@@ -1,8 +1,12 @@
-The go-only subtree of proton is maintained on the branch `go1` for the `go get` command.
-`go1` is special to the `go get` command, it will use that branch rather than `master`
-when it is present.
+The go-only subtree of proton is maintained on the branch `go1` for the `go get`
+command.  `go1` is special to the `go get` command, it will use that branch
+rather than `master` when it is present.
 
 Created with: `git subtree split --prefix=proton-c/bindings/go/src/qpid.apache.org -b go1`
 Update with:  `git checkout go1; git merge -s subtree master`
 
 To see the branch description: `git config branch.go1.description`
+
+NOTE: when updating the branch, you should also visit the doc pages at
+https://godoc.org/?q=qpid.apache.org and click "Refresh now" at the bottom of
+the page


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org