[ARVADOS] updated: 1.3.0-3179-g40fd03351

Git user git at public.arvados.org
Fri Sep 18 00:07:29 UTC 2020


Summary of changes:
 lib/controller/federation/conn.go | 70 ++++++++++++++++++---------------------
 sdk/go/stats/duration.go          |  2 +-
 2 files changed, 34 insertions(+), 38 deletions(-)

       via  40fd03351707cd5892d40014cf366c7ec1834b85 (commit)
      from  2a3c78659dfdb264cd65ef6ababbd973062b4eae (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 40fd03351707cd5892d40014cf366c7ec1834b85
Author: Ward Vandewege <ward at curii.com>
Date:   Thu Sep 17 20:07:02 2020 -0400

    Fix some more golint warnings.
    
    No issue #
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go
index d715734c6..361c9613d 100644
--- a/lib/controller/federation/conn.go
+++ b/lib/controller/federation/conn.go
@@ -114,9 +114,8 @@ func (conn *Conn) chooseBackend(id string) backend {
 func (conn *Conn) localOrLoginCluster() backend {
 	if conn.cluster.Login.LoginCluster != "" {
 		return conn.chooseBackend(conn.cluster.Login.LoginCluster)
-	} else {
-		return conn.local
 	}
+	return conn.local
 }
 
 // Call fn with the local backend; then, if fn returned 404, call fn
@@ -243,40 +242,39 @@ func (conn *Conn) CollectionGet(ctx context.Context, options arvados.GetOptions)
 			c.ManifestText = rewriteManifest(c.ManifestText, options.UUID[:5])
 		}
 		return c, err
-	} else {
-		// UUID is a PDH
-		first := make(chan arvados.Collection, 1)
-		err := conn.tryLocalThenRemotes(ctx, options.ForwardedFor, func(ctx context.Context, remoteID string, be backend) error {
-			remoteOpts := options
-			remoteOpts.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-			c, err := be.CollectionGet(ctx, remoteOpts)
-			if err != nil {
-				return err
-			}
-			// options.UUID is either hash+size or
-			// hash+size+hints; only hash+size need to
-			// match the computed PDH.
-			if pdh := arvados.PortableDataHash(c.ManifestText); pdh != options.UUID && !strings.HasPrefix(options.UUID, pdh+"+") {
-				err = httpErrorf(http.StatusBadGateway, "bad portable data hash %q received from remote %q (expected %q)", pdh, remoteID, options.UUID)
-				ctxlog.FromContext(ctx).Warn(err)
-				return err
-			}
-			if remoteID != "" {
-				c.ManifestText = rewriteManifest(c.ManifestText, remoteID)
-			}
-			select {
-			case first <- c:
-				return nil
-			default:
-				// lost race, return value doesn't matter
-				return nil
-			}
-		})
+	}
+	// UUID is a PDH
+	first := make(chan arvados.Collection, 1)
+	err := conn.tryLocalThenRemotes(ctx, options.ForwardedFor, func(ctx context.Context, remoteID string, be backend) error {
+		remoteOpts := options
+		remoteOpts.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
+		c, err := be.CollectionGet(ctx, remoteOpts)
 		if err != nil {
-			return arvados.Collection{}, err
+			return err
 		}
-		return <-first, nil
+		// options.UUID is either hash+size or
+		// hash+size+hints; only hash+size need to
+		// match the computed PDH.
+		if pdh := arvados.PortableDataHash(c.ManifestText); pdh != options.UUID && !strings.HasPrefix(options.UUID, pdh+"+") {
+			err = httpErrorf(http.StatusBadGateway, "bad portable data hash %q received from remote %q (expected %q)", pdh, remoteID, options.UUID)
+			ctxlog.FromContext(ctx).Warn(err)
+			return err
+		}
+		if remoteID != "" {
+			c.ManifestText = rewriteManifest(c.ManifestText, remoteID)
+		}
+		select {
+		case first <- c:
+			return nil
+		default:
+			// lost race, return value doesn't matter
+			return nil
+		}
+	})
+	if err != nil {
+		return arvados.Collection{}, err
 	}
+	return <-first, nil
 }
 
 func (conn *Conn) CollectionList(ctx context.Context, options arvados.ListOptions) (arvados.CollectionList, error) {
@@ -445,9 +443,8 @@ func (conn *Conn) UserList(ctx context.Context, options arvados.ListOptions) (ar
 			return arvados.UserList{}, err
 		}
 		return resp, nil
-	} else {
-		return conn.generated_UserList(ctx, options)
 	}
+	return conn.generated_UserList(ctx, options)
 }
 
 func (conn *Conn) UserCreate(ctx context.Context, options arvados.CreateOptions) (arvados.User, error) {
@@ -544,7 +541,6 @@ func (notFoundError) Error() string   { return "not found" }
 func errStatus(err error) int {
 	if httpErr, ok := err.(interface{ HTTPStatus() int }); ok {
 		return httpErr.HTTPStatus()
-	} else {
-		return http.StatusInternalServerError
 	}
+	return http.StatusInternalServerError
 }
diff --git a/sdk/go/stats/duration.go b/sdk/go/stats/duration.go
index cf9172633..facb71d21 100644
--- a/sdk/go/stats/duration.go
+++ b/sdk/go/stats/duration.go
@@ -29,7 +29,7 @@ func (d *Duration) UnmarshalJSON(data []byte) error {
 	return d.Set(string(data))
 }
 
-// Value implements flag.Value
+// Set implements flag.Value
 func (d *Duration) Set(s string) error {
 	sec, err := strconv.ParseFloat(s, 64)
 	if err == nil {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list