Skip to content

Commit 52083ff

Browse files
committed
fix variable names collding with imported package names
1 parent b490dbf commit 52083ff

File tree

8 files changed

+33
-33
lines changed

8 files changed

+33
-33
lines changed

configuration/template/fields.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func (fields Fields) Execute(confSvc ConfigurationService, parentPath string, va
343343

344344
func copyMap(src map[string]interface{}, dest map[string]interface{}) {
345345
for k, v := range src {
346-
vm, ok := v.(map[string]interface{})
346+
vmap, ok := v.(map[string]interface{})
347347
if ok {
348348
var destk map[string]interface{}
349349
if _, exists := dest[k]; exists {
@@ -354,7 +354,7 @@ func copyMap(src map[string]interface{}, dest map[string]interface{}) {
354354
} else {
355355
destk = make(map[string]interface{})
356356
}
357-
copyMap(vm, destk)
357+
copyMap(vmap, destk)
358358
dest[k] = destk
359359
} else {
360360
dest[k] = v

core/server.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,24 +860,24 @@ func (m *RpcServer) GetTask(cxt context.Context, req *pb.GetTaskRequest) (*pb.Ge
860860
m.logMethod()
861861
defer m.logMethodHandled()
862862

863-
task := m.state.taskman.GetTask(req.TaskId)
864-
if task == nil {
863+
requestedTask := m.state.taskman.GetTask(req.TaskId)
864+
if requestedTask == nil {
865865
return &pb.GetTaskReply{Timestamp: currentUnixMilli()}, status.New(codes.NotFound, "task not found").Err()
866866
}
867-
taskClass := task.GetTaskClass()
868-
commandInfo := task.GetTaskCommandInfo()
867+
taskClass := requestedTask.GetTaskClass()
868+
commandInfo := requestedTask.GetTaskCommandInfo()
869869
var outbound []channel.Outbound
870870
var inbound []channel.Inbound
871871
taskPath := ""
872872
// TODO: probably not the nicest way to do this... the outbound assignments should be cached
873873
// in the Task
874-
if task.IsLocked() {
874+
if requestedTask.IsLocked() {
875875
type parentRole interface {
876876
CollectOutboundChannels() []channel.Outbound
877877
GetPath() string
878878
CollectInboundChannels() []channel.Inbound
879879
}
880-
parent, ok := task.GetParentRole().(parentRole)
880+
parent, ok := requestedTask.GetParentRole().(parentRole)
881881
if ok {
882882
outbound = channel.MergeOutbound(parent.CollectOutboundChannels(), taskClass.Connect)
883883
taskPath = parent.GetPath()
@@ -891,13 +891,13 @@ func (m *RpcServer) GetTask(cxt context.Context, req *pb.GetTaskRequest) (*pb.Ge
891891

892892
rep := &pb.GetTaskReply{
893893
Task: &pb.TaskInfo{
894-
ShortInfo: taskToShortTaskInfo(task, m.state.taskman),
894+
ShortInfo: taskToShortTaskInfo(requestedTask, m.state.taskman),
895895
InboundChannels: inboundChannelsToPbChannels(inbound),
896896
OutboundChannels: outboundChannelsToPbChannels(outbound),
897897
CommandInfo: commandInfoToPbCommandInfo(commandInfo),
898898
TaskPath: taskPath,
899-
EnvId: task.GetEnvironmentId().String(),
900-
Properties: task.GetProperties(),
899+
EnvId: requestedTask.GetEnvironmentId().String(),
900+
Properties: requestedTask.GetProperties(),
901901
},
902902
Timestamp: currentUnixMilli(),
903903
}

core/task/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ func (m *Manager) configureTasks(envId uid.ID, tasks Tasks) error {
744744
Debug("generated inbound bindMap for environment configuration")
745745

746746
src := sm.STANDBY.String()
747-
event := "CONFIGURE"
747+
evt := "CONFIGURE"
748748
dest := sm.CONFIGURED.String()
749749
args := make(controlcommands.PropertyMapsMap)
750750
args, err = tasks.BuildPropertyMaps(bindMap)
@@ -755,7 +755,7 @@ func (m *Manager) configureTasks(envId uid.ID, tasks Tasks) error {
755755
WithField("partition", envId.String()).
756756
Debug("pushing configuration to tasks")
757757

758-
cmd := controlcommands.NewMesosCommand_Transition(envId, receivers, src, event, dest, args)
758+
cmd := controlcommands.NewMesosCommand_Transition(envId, receivers, src, evt, dest, args)
759759
cmd.ResponseTimeout = 120 * time.Second // The default timeout is 90 seconds, but we need more time for the tasks to configure
760760
_ = m.cq.Enqueue(cmd, notify)
761761

core/task/scheduler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,12 +1516,12 @@ func makeTaskForMesosResources(
15161516
WithField("inboundChannels", func() string {
15171517
accu := make([]string, len(wants.InboundChannels))
15181518
for i := 0; i < len(wants.InboundChannels); i++ {
1519-
channel := wants.InboundChannels[i]
1520-
accu[i] = channel.Name
1521-
if len(channel.Global) > 0 {
1522-
accu[i] += fmt.Sprintf(" (global: %s)", channel.Global)
1519+
inboundChannel := wants.InboundChannels[i]
1520+
accu[i] = inboundChannel.Name
1521+
if len(inboundChannel.Global) > 0 {
1522+
accu[i] += fmt.Sprintf(" (global: %s)", inboundChannel.Global)
15231523
}
1524-
if endpoint, ok := bindMap[channel.Name]; ok {
1524+
if endpoint, ok := bindMap[inboundChannel.Name]; ok {
15251525
accu[i] += fmt.Sprintf(" -> %s", endpoint.GetAddress())
15261526
}
15271527
}

core/workflow/callable/call.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ func NewCall(funcCall string, returnVar string, parent ParentRole) (call *Call)
7272
}
7373

7474
func (s Calls) CallAll() map[*Call]error {
75-
errors := make(map[*Call]error)
75+
errs := make(map[*Call]error)
7676
for _, v := range s {
7777
err := v.Call()
7878
if err != nil {
79-
errors[v] = err
79+
errs[v] = err
8080
}
8181
}
82-
return errors
82+
return errs
8383
}
8484

8585
func (s Calls) StartAll() {
@@ -90,20 +90,20 @@ func (s Calls) StartAll() {
9090

9191
func (s Calls) AwaitAll() map[*Call]error {
9292
// Since each Await call blocks, we call it in parallel and then collect
93-
errors := make(map[*Call]error)
93+
errs := make(map[*Call]error)
9494
wg := &sync.WaitGroup{}
9595
wg.Add(len(s))
9696
for _, v := range s {
9797
go func(v *Call) {
9898
defer wg.Done()
9999
err := v.Await()
100100
if err != nil {
101-
errors[v] = err
101+
errs[v] = err
102102
}
103103
}(v)
104104
}
105105
wg.Wait()
106-
return errors
106+
return errs
107107
}
108108

109109
func (c *Call) Call() error {

executor/executable/task.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,20 @@ func prepareTaskCmd(commandInfo *common.TaskCommandInfo) (*exec.Cmd, error) {
208208
return nil, err
209209
}
210210

211-
uid, err := strconv.ParseUint(targetUser.Uid, 10, 32)
211+
userid, err := strconv.ParseUint(targetUser.Uid, 10, 32)
212212
if err != nil {
213213
return nil, err
214214
}
215-
gid, err := strconv.ParseUint(targetUser.Gid, 10, 32)
215+
groupid, err := strconv.ParseUint(targetUser.Gid, 10, 32)
216216
if err != nil {
217217
return nil, err
218218
}
219219

220220
gids, gidStrings := executorutil.GetGroupIDs(targetUser)
221221

222222
credential := &syscall.Credential{
223-
Uid: uint32(uid),
224-
Gid: uint32(gid),
223+
Uid: uint32(userid),
224+
Gid: uint32(groupid),
225225
Groups: gids,
226226
NoSetGroups: false,
227227
}

executor/executor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func Run(cfg config.Config) {
111111
Host: cfg.AgentEndpoint,
112112
Path: apiPath,
113113
}
114-
http = httpcli.New(
114+
client = httpcli.New(
115115
httpcli.Endpoint(apiURL.String()),
116116
httpcli.Codec(codecs.ByMediaType[codecs.MediaTypeProtobuf]),
117117
httpcli.Do(httpcli.With(
@@ -132,7 +132,7 @@ func Run(cfg config.Config) {
132132
state = &internalState{
133133
// With this we inject the callOptions into all outgoing calls
134134
cli: calls.SenderWith(
135-
httpexec.NewSender(http.Send),
135+
httpexec.NewSender(client.Send),
136136
callOptions...,
137137
),
138138
// The executor keeps lists of unacknowledged tasks and unacknowledged updates. In case of unexpected
@@ -151,7 +151,7 @@ func Run(cfg config.Config) {
151151
}
152152
subscriber = calls.SenderWith(
153153
// Here too, callOptions for all outgoing subscriber calls
154-
httpexec.NewSender(http.Send, httpcli.Close(true)),
154+
httpexec.NewSender(client.Send, httpcli.Close(true)),
155155
callOptions...,
156156
)
157157

executor/executorcmd/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
"github.com/AliceO2Group/Control/executor/executorcmd/transitioner"
4444
pb "github.com/AliceO2Group/Control/executor/protos"
4545
"github.com/sirupsen/logrus"
46-
"google.golang.org/grpc/status"
46+
grpcstatus "google.golang.org/grpc/status"
4747
)
4848

4949
type ControlTransport uint32
@@ -164,7 +164,7 @@ func (r *RpcClient) doTransition(ei transitioner.EventInfo) (newState string, er
164164
}, grpc.EmptyCallOption{})
165165

166166
if err != nil {
167-
status, ok := status.FromError(err)
167+
status, ok := grpcstatus.FromError(err)
168168
if ok {
169169
r.Log.WithFields(logrus.Fields{
170170
"code": status.Code().String(),

0 commit comments

Comments
 (0)