[ARVADOS] updated: 833c4e9022ab3efd6a8f9277f7e0d281250bb636

git at public.curoverse.com git at public.curoverse.com
Mon Jun 8 09:36:23 EDT 2015


Summary of changes:
 sdk/go/arvadosclient/arvadosclient.go      | 16 +++++++++++-----
 sdk/go/arvadosclient/arvadosclient_test.go | 10 +++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

       via  833c4e9022ab3efd6a8f9277f7e0d281250bb636 (commit)
      from  c9e40c6e552bc35f661eb3ed8eff04786cf40566 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 833c4e9022ab3efd6a8f9277f7e0d281250bb636
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jun 8 09:36:33 2015 -0400

    6235: Discovery() returns the requested value directly instead of a single-entry map.

diff --git a/sdk/go/arvadosclient/arvadosclient.go b/sdk/go/arvadosclient/arvadosclient.go
index 62eda5b..bb06126 100644
--- a/sdk/go/arvadosclient/arvadosclient.go
+++ b/sdk/go/arvadosclient/arvadosclient.go
@@ -289,14 +289,20 @@ func (this ArvadosClient) List(resource string, parameters Dict, output interfac
 //   err - error accessing the resource, or nil if no error
 var API_DISCOVERY_RESOURCE string = "discovery/v1/apis/arvados/v1/rest"
 
-func (this *ArvadosClient) Discovery(parameter string) (valueMap Dict, err error) {
+func (this *ArvadosClient) Discovery(parameter string) (value interface{}, err error) {
 	if len(this.DiscoveryDoc) == 0 {
 		this.DiscoveryDoc = make(Dict)
 		err = this.Call("GET", API_DISCOVERY_RESOURCE, "", "", nil, &this.DiscoveryDoc)
+		if err != nil {
+			return nil, err
+		}
 	}
 
-	valueMap = make(Dict)
-	valueMap[parameter] = this.DiscoveryDoc[parameter]
-
-	return valueMap, err
+	var found bool
+	value, found = this.DiscoveryDoc[parameter]
+	if found {
+		return value, nil
+	} else {
+		return value, errors.New("Not found")
+	}
 }
diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go
index 17911c6..6a9e13b 100644
--- a/sdk/go/arvadosclient/arvadosclient_test.go
+++ b/sdk/go/arvadosclient/arvadosclient_test.go
@@ -105,14 +105,14 @@ func (s *ServerRequiredSuite) TestErrorResponse(c *C) {
 
 func (s *ServerRequiredSuite) TestAPIDiscovery_Get_defaultCollectionReplication(c *C) {
 	arv, err := MakeArvadosClient()
-	valueMap, err := arv.Discovery("defaultCollectionReplication")
+	value, err := arv.Discovery("defaultCollectionReplication")
 	c.Assert(err, IsNil)
-	c.Assert(valueMap["defaultCollectionReplication"], NotNil)
+	c.Assert(value, NotNil)
 }
 
 func (s *ServerRequiredSuite) TestAPIDiscovery_Get_noSuchParameter(c *C) {
 	arv, err := MakeArvadosClient()
-	valueMap, err := arv.Discovery("noSuchParameter")
-	c.Assert(err, IsNil)
-	c.Assert(valueMap["noSuchParameter"], IsNil)
+	value, err := arv.Discovery("noSuchParameter")
+	c.Assert(err, NotNil)
+	c.Assert(value, IsNil)
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list