From bfda26d91ec069f3ff33d56d55b60dc2fa024a25 Mon Sep 17 00:00:00 2001 From: Dan Gottlieb Date: Tue, 28 Jan 2025 11:29:32 -0500 Subject: [PATCH] comments --- module/module.go | 3 ++- module/testmodule/main.go | 6 ++---- robot/client/client_options.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/module/module.go b/module/module.go index 027aaece83a..958393df2eb 100644 --- a/module/module.go +++ b/module/module.go @@ -175,7 +175,8 @@ type peerResourceState struct { // Module represents an external resource module that services components/services. type Module struct { - // The name of the module as per the robot config. + // The name of the module as per the robot config. This value is communicated via the + // `VIAM_MODULE_NAME` env var. name string shutdownCtx context.Context diff --git a/module/testmodule/main.go b/module/testmodule/main.go index a73483753eb..c28409ba571 100644 --- a/module/testmodule/main.go +++ b/module/testmodule/main.go @@ -108,10 +108,8 @@ func newHelper( ctx context.Context, deps resource.Dependencies, conf resource.Config, logger logging.Logger, ) (resource.Resource, error) { var dependsOnSensor sensor.Sensor - for _, resObj := range deps { - if resSensor, ok := resObj.(sensor.Sensor); ok { - dependsOnSensor = resSensor - } + if len(conf.DependsOn) > 0 { + dependsOnSensor, err := sensor.FromDependencies(deps, conf.DependsOn[0]) } if len(deps) > 0 && dependsOnSensor == nil { diff --git a/robot/client/client_options.go b/robot/client/client_options.go index a90de5d90e7..4e7a11d79bf 100644 --- a/robot/client/client_options.go +++ b/robot/client/client_options.go @@ -59,7 +59,7 @@ func newFuncRobotClientOption(f func(*robotClientOpts)) *funcRobotClientOption { } // WithModName attaches a unary interceptor that attaches the module name for each outgoing gRPC -// request. +// request. Should only be used in Viam module library code. func WithModName(modName string) RobotClientOption { return newFuncRobotClientOption(func(o *robotClientOpts) { o.modName = modName