Cleanup: some smaller renames & small function return type change

This commit is contained in:
Sybren A. Stüvel 2022-02-21 19:32:12 +01:00
parent 2e0f44b947
commit 5b0e11acdc

View File

@ -202,13 +202,13 @@ func (s *Service) ListJobTypes() api.AvailableJobTypes {
continue continue
} }
description, err := compiler.getJobTypeInfo() jobType, err := compiler.getJobTypeInfo()
if err != nil { if err != nil {
log.Warn().Err(err).Str("jobType", typeName).Msg("unable to determine job type settings") log.Warn().Err(err).Str("jobType", typeName).Msg("unable to determine job type settings")
continue continue
} }
jobTypes = append(jobTypes, *description) jobTypes = append(jobTypes, jobType)
} }
return api.AvailableJobTypes{JobTypes: jobTypes} return api.AvailableJobTypes{JobTypes: jobTypes}
} }
@ -231,7 +231,7 @@ func (vm *VM) getCompileJob() (jobCompileFunc, error) {
}, nil }, nil
} }
func (vm *VM) getJobTypeInfo() (*api.AvailableJobType, error) { func (vm *VM) getJobTypeInfo() (api.AvailableJobType, error) {
jtValue := vm.runtime.Get("JOB_TYPE") jtValue := vm.runtime.Get("JOB_TYPE")
var ajt api.AvailableJobType var ajt api.AvailableJobType
@ -242,9 +242,9 @@ func (vm *VM) getJobTypeInfo() (*api.AvailableJobType, error) {
Str("jobType", vm.compiler.jobType). Str("jobType", vm.compiler.jobType).
Str("script", vm.compiler.filename). Str("script", vm.compiler.filename).
Msg("script does not define a proper JOB_TYPE object") Msg("script does not define a proper JOB_TYPE object")
return nil, ErrScriptIncomplete return api.AvailableJobType{}, ErrScriptIncomplete
} }
ajt.Name = vm.compiler.jobType ajt.Name = vm.compiler.jobType
return &ajt, nil return ajt, nil
} }