Cleanup: rename local var from compiler to service

The `Load()` function returns a `*Service`, and it was confusing that the
local variable is named `compiler` instead. Now it's called `service`.

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2022-06-20 17:21:19 +02:00
parent 89fdc45b45
commit d5c527209f

View File

@ -49,12 +49,12 @@ type TimeService interface {
// Load returns a job compiler service with all JS files loaded.
func Load(ts TimeService) (*Service, error) {
compiler := Service{
service := Service{
compilers: map[string]Compiler{},
timeService: ts,
}
if err := compiler.loadScripts(); err != nil {
if err := service.loadScripts(); err != nil {
return nil, err
}
@ -69,12 +69,12 @@ func Load(ts TimeService) (*Service, error) {
return content, nil
}
compiler.registry = require.NewRegistry(require.WithLoader(staticFileLoader))
compiler.registry.RegisterNativeModule("author", AuthorModule)
compiler.registry.RegisterNativeModule("path", PathModule)
compiler.registry.RegisterNativeModule("process", ProcessModule)
service.registry = require.NewRegistry(require.WithLoader(staticFileLoader))
service.registry.RegisterNativeModule("author", AuthorModule)
service.registry.RegisterNativeModule("path", PathModule)
service.registry.RegisterNativeModule("process", ProcessModule)
return &compiler, nil
return &service, nil
}
func (s *Service) Compile(ctx context.Context, sj api.SubmittedJob) (*AuthoredJob, error) {