[ARVADOS] updated: 2.1.0-96-g82e63aa2a
Git user
git at public.arvados.org
Sun Nov 15 19:18:50 UTC 2020
Summary of changes:
lib/service/cmd_test.go | 9 ++++--
sdk/go/arvados/client.go | 1 +
sdk/go/arvadostest/api.go | 80 +++++++++++++++++++++++------------------------
3 files changed, 48 insertions(+), 42 deletions(-)
via 82e63aa2aeaf2747a21058498f234f135d9867a6 (commit)
from 059e2806a7ac61a5b6849f755294b770ea91d0cb (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 82e63aa2aeaf2747a21058498f234f135d9867a6
Author: Ward Vandewege <ward at curii.com>
Date: Sun Nov 15 14:18:40 2020 -0500
Fix more golint warnings.
No issue #
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/lib/service/cmd_test.go b/lib/service/cmd_test.go
index 4a984c9e7..10591d9b5 100644
--- a/lib/service/cmd_test.go
+++ b/lib/service/cmd_test.go
@@ -29,6 +29,11 @@ func Test(t *testing.T) {
var _ = check.Suite(&Suite{})
type Suite struct{}
+type key int
+
+const (
+ contextKey key = iota
+)
func (*Suite) TestCommand(c *check.C) {
cf, err := ioutil.TempFile("", "cmd_test.")
@@ -42,11 +47,11 @@ func (*Suite) TestCommand(c *check.C) {
defer cancel()
cmd := Command(arvados.ServiceNameController, func(ctx context.Context, _ *arvados.Cluster, token string, reg *prometheus.Registry) Handler {
- c.Check(ctx.Value("foo"), check.Equals, "bar")
+ c.Check(ctx.Value(contextKey), check.Equals, "bar")
c.Check(token, check.Equals, "abcde")
return &testHandler{ctx: ctx, healthCheck: healthCheck}
})
- cmd.(*command).ctx = context.WithValue(ctx, "foo", "bar")
+ cmd.(*command).ctx = context.WithValue(ctx, contextKey, "bar")
done := make(chan bool)
var stdin, stdout, stderr bytes.Buffer
diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go
index 5c6a7b52f..52c75d511 100644
--- a/sdk/go/arvados/client.go
+++ b/sdk/go/arvados/client.go
@@ -306,6 +306,7 @@ func (c *Client) RequestAndDecode(dst interface{}, method, path string, body io.
return c.RequestAndDecodeContext(context.Background(), dst, method, path, body, params)
}
+// RequestAndDecodeContext does the same as RequestAndDecode, but with a context
func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, method, path string, body io.Reader, params interface{}) error {
if body, ok := body.(io.Closer); ok {
// Ensure body is closed even if we error out early
diff --git a/sdk/go/arvadostest/api.go b/sdk/go/arvadostest/api.go
index fa5f53936..039d7ae11 100644
--- a/sdk/go/arvadostest/api.go
+++ b/sdk/go/arvadostest/api.go
@@ -30,163 +30,163 @@ func (as *APIStub) BaseURL() url.URL {
return url.URL{Scheme: "https", Host: "apistub.example.com"}
}
func (as *APIStub) ConfigGet(ctx context.Context) (json.RawMessage, error) {
- as.appendCall(as.ConfigGet, ctx, nil)
+ as.appendCall(ctx, as.ConfigGet, nil)
return nil, as.Error
}
func (as *APIStub) Login(ctx context.Context, options arvados.LoginOptions) (arvados.LoginResponse, error) {
- as.appendCall(as.Login, ctx, options)
+ as.appendCall(ctx, as.Login, options)
return arvados.LoginResponse{}, as.Error
}
func (as *APIStub) Logout(ctx context.Context, options arvados.LogoutOptions) (arvados.LogoutResponse, error) {
- as.appendCall(as.Logout, ctx, options)
+ as.appendCall(ctx, as.Logout, options)
return arvados.LogoutResponse{}, as.Error
}
func (as *APIStub) CollectionCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionCreate, ctx, options)
+ as.appendCall(ctx, as.CollectionCreate, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) CollectionUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionUpdate, ctx, options)
+ as.appendCall(ctx, as.CollectionUpdate, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) CollectionGet(ctx context.Context, options arvados.GetOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionGet, ctx, options)
+ as.appendCall(ctx, as.CollectionGet, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) CollectionList(ctx context.Context, options arvados.ListOptions) (arvados.CollectionList, error) {
- as.appendCall(as.CollectionList, ctx, options)
+ as.appendCall(ctx, as.CollectionList, options)
return arvados.CollectionList{}, as.Error
}
func (as *APIStub) CollectionProvenance(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
- as.appendCall(as.CollectionProvenance, ctx, options)
+ as.appendCall(ctx, as.CollectionProvenance, options)
return nil, as.Error
}
func (as *APIStub) CollectionUsedBy(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
- as.appendCall(as.CollectionUsedBy, ctx, options)
+ as.appendCall(ctx, as.CollectionUsedBy, options)
return nil, as.Error
}
func (as *APIStub) CollectionDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionDelete, ctx, options)
+ as.appendCall(ctx, as.CollectionDelete, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) CollectionTrash(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionTrash, ctx, options)
+ as.appendCall(ctx, as.CollectionTrash, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) CollectionUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Collection, error) {
- as.appendCall(as.CollectionUntrash, ctx, options)
+ as.appendCall(ctx, as.CollectionUntrash, options)
return arvados.Collection{}, as.Error
}
func (as *APIStub) ContainerCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerCreate, ctx, options)
+ as.appendCall(ctx, as.ContainerCreate, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) ContainerUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerUpdate, ctx, options)
+ as.appendCall(ctx, as.ContainerUpdate, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) ContainerGet(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerGet, ctx, options)
+ as.appendCall(ctx, as.ContainerGet, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) ContainerList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerList, error) {
- as.appendCall(as.ContainerList, ctx, options)
+ as.appendCall(ctx, as.ContainerList, options)
return arvados.ContainerList{}, as.Error
}
func (as *APIStub) ContainerDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerDelete, ctx, options)
+ as.appendCall(ctx, as.ContainerDelete, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) ContainerLock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerLock, ctx, options)
+ as.appendCall(ctx, as.ContainerLock, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) ContainerUnlock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
- as.appendCall(as.ContainerUnlock, ctx, options)
+ as.appendCall(ctx, as.ContainerUnlock, options)
return arvados.Container{}, as.Error
}
func (as *APIStub) SpecimenCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Specimen, error) {
- as.appendCall(as.SpecimenCreate, ctx, options)
+ as.appendCall(ctx, as.SpecimenCreate, options)
return arvados.Specimen{}, as.Error
}
func (as *APIStub) SpecimenUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Specimen, error) {
- as.appendCall(as.SpecimenUpdate, ctx, options)
+ as.appendCall(ctx, as.SpecimenUpdate, options)
return arvados.Specimen{}, as.Error
}
func (as *APIStub) SpecimenGet(ctx context.Context, options arvados.GetOptions) (arvados.Specimen, error) {
- as.appendCall(as.SpecimenGet, ctx, options)
+ as.appendCall(ctx, as.SpecimenGet, options)
return arvados.Specimen{}, as.Error
}
func (as *APIStub) SpecimenList(ctx context.Context, options arvados.ListOptions) (arvados.SpecimenList, error) {
- as.appendCall(as.SpecimenList, ctx, options)
+ as.appendCall(ctx, as.SpecimenList, options)
return arvados.SpecimenList{}, as.Error
}
func (as *APIStub) SpecimenDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Specimen, error) {
- as.appendCall(as.SpecimenDelete, ctx, options)
+ as.appendCall(ctx, as.SpecimenDelete, options)
return arvados.Specimen{}, as.Error
}
func (as *APIStub) UserCreate(ctx context.Context, options arvados.CreateOptions) (arvados.User, error) {
- as.appendCall(as.UserCreate, ctx, options)
+ as.appendCall(ctx, as.UserCreate, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.User, error) {
- as.appendCall(as.UserUpdate, ctx, options)
+ as.appendCall(ctx, as.UserUpdate, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserUpdateUUID(ctx context.Context, options arvados.UpdateUUIDOptions) (arvados.User, error) {
- as.appendCall(as.UserUpdateUUID, ctx, options)
+ as.appendCall(ctx, as.UserUpdateUUID, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserActivate(ctx context.Context, options arvados.UserActivateOptions) (arvados.User, error) {
- as.appendCall(as.UserActivate, ctx, options)
+ as.appendCall(ctx, as.UserActivate, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserSetup(ctx context.Context, options arvados.UserSetupOptions) (map[string]interface{}, error) {
- as.appendCall(as.UserSetup, ctx, options)
+ as.appendCall(ctx, as.UserSetup, options)
return nil, as.Error
}
func (as *APIStub) UserUnsetup(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
- as.appendCall(as.UserUnsetup, ctx, options)
+ as.appendCall(ctx, as.UserUnsetup, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserGet(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
- as.appendCall(as.UserGet, ctx, options)
+ as.appendCall(ctx, as.UserGet, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserGetCurrent(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
- as.appendCall(as.UserGetCurrent, ctx, options)
+ as.appendCall(ctx, as.UserGetCurrent, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserGetSystem(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
- as.appendCall(as.UserGetSystem, ctx, options)
+ as.appendCall(ctx, as.UserGetSystem, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserList(ctx context.Context, options arvados.ListOptions) (arvados.UserList, error) {
- as.appendCall(as.UserList, ctx, options)
+ as.appendCall(ctx, as.UserList, options)
return arvados.UserList{}, as.Error
}
func (as *APIStub) UserDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.User, error) {
- as.appendCall(as.UserDelete, ctx, options)
+ as.appendCall(ctx, as.UserDelete, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserMerge(ctx context.Context, options arvados.UserMergeOptions) (arvados.User, error) {
- as.appendCall(as.UserMerge, ctx, options)
+ as.appendCall(ctx, as.UserMerge, options)
return arvados.User{}, as.Error
}
func (as *APIStub) UserBatchUpdate(ctx context.Context, options arvados.UserBatchUpdateOptions) (arvados.UserList, error) {
- as.appendCall(as.UserBatchUpdate, ctx, options)
+ as.appendCall(ctx, as.UserBatchUpdate, options)
return arvados.UserList{}, as.Error
}
func (as *APIStub) UserAuthenticate(ctx context.Context, options arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
- as.appendCall(as.UserAuthenticate, ctx, options)
+ as.appendCall(ctx, as.UserAuthenticate, options)
return arvados.APIClientAuthorization{}, as.Error
}
func (as *APIStub) APIClientAuthorizationCurrent(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
- as.appendCall(as.APIClientAuthorizationCurrent, ctx, options)
+ as.appendCall(ctx, as.APIClientAuthorizationCurrent, options)
return arvados.APIClientAuthorization{}, as.Error
}
-func (as *APIStub) appendCall(method interface{}, ctx context.Context, options interface{}) {
+func (as *APIStub) appendCall(ctx context.Context, method interface{}, options interface{}) {
as.mtx.Lock()
defer as.mtx.Unlock()
as.calls = append(as.calls, APIStubCall{method, ctx, options})
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list