Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit d81a9bd

Browse files
authored
Merge pull request #368 from vdemeester/remove-context-field-from-service
Remove ctx.Context field from Service struct.
2 parents a5702b9 + f7d7b44 commit d81a9bd

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

docker/service/convert.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
composecontainer "github.com/docker/libcompose/docker/container"
1818
"github.com/docker/libcompose/project"
1919
"github.com/docker/libcompose/utils"
20-
// "github.com/docker/libcompose/yaml"
2120
)
2221

2322
// ConfigWrapper wraps Config, HostConfig and NetworkingConfig for a container.

docker/service/service.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/docker/libcompose/docker/ctx"
2323
"github.com/docker/libcompose/docker/image"
2424
"github.com/docker/libcompose/labels"
25+
"github.com/docker/libcompose/logger"
2526
"github.com/docker/libcompose/project"
2627
"github.com/docker/libcompose/project/events"
2728
"github.com/docker/libcompose/project/options"
@@ -36,10 +37,8 @@ type Service struct {
3637
project *project.Project
3738
serviceConfig *config.ServiceConfig
3839
clientFactory composeclient.Factory
40+
loggerFactory logger.Factory
3941
authLookup auth.Lookup
40-
41-
// FIXME(vdemeester) remove this at some point
42-
context *ctx.Context
4342
}
4443

4544
// NewService creates a service
@@ -50,7 +49,7 @@ func NewService(name string, serviceConfig *config.ServiceConfig, context *ctx.C
5049
serviceConfig: serviceConfig,
5150
clientFactory: context.ClientFactory,
5251
authLookup: context.AuthLookup,
53-
context: context,
52+
loggerFactory: context.LoggerFactory,
5453
}
5554
}
5655

@@ -199,7 +198,7 @@ func (s *Service) build(ctx context.Context, buildOptions options.Build) error {
199198
NoCache: buildOptions.NoCache,
200199
ForceRemove: buildOptions.ForceRemove,
201200
Pull: buildOptions.Pull,
202-
LoggerFactory: s.context.LoggerFactory,
201+
LoggerFactory: s.loggerFactory,
203202
}
204203
return builder.Build(ctx, s.imageName())
205204
}
@@ -585,7 +584,7 @@ func (s *Service) Log(ctx context.Context, follow bool) error {
585584
if s.Config().ContainerName != "" {
586585
name = s.Config().ContainerName
587586
}
588-
l := s.context.LoggerFactory.CreateContainerLogger(name)
587+
l := s.loggerFactory.CreateContainerLogger(name)
589588
return c.Log(ctx, l, follow)
590589
})
591590
}

0 commit comments

Comments
 (0)