pkg/bridge: fix importShadow: shadow of imported package (gocritic)

pkg/bridge/convert.go:114:3: importShadow: shadow of imported package 'user' (gocritic)
            user, err := user.Current()
            ^
    pkg/bridge/convert.go:142:51: importShadow: shadow of imported from 'github.com/docker/cli/cli/command/container' package 'cli' (gocritic)
    func LoadAdditionalResources(ctx context.Context, cli command.Cli, project *types.Project) (*types.Project, error) {
                                                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-05-29 10:22:24 +02:00 committed by Guillaume Lours
parent ad4cbee498
commit 7c79b23005

View File

@ -112,14 +112,14 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
return err return err
} }
user, err := user.Current() usr, err := user.Current()
if err != nil { if err != nil {
return err return err
} }
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{ created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
Image: transformation, Image: transformation,
Env: []string{"LICENSE_AGREEMENT=true"}, Env: []string{"LICENSE_AGREEMENT=true"},
User: user.Uid, User: usr.Uid,
}, &container.HostConfig{ }, &container.HostConfig{
AutoRemove: true, AutoRemove: true,
Binds: binds, Binds: binds,
@ -140,11 +140,11 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
} }
// LoadAdditionalResources loads additional resources from the project, such as image references, secrets, configs and exposed ports // LoadAdditionalResources loads additional resources from the project, such as image references, secrets, configs and exposed ports
func LoadAdditionalResources(ctx context.Context, cli command.Cli, project *types.Project) (*types.Project, error) { func LoadAdditionalResources(ctx context.Context, dockerCLI command.Cli, project *types.Project) (*types.Project, error) {
for name, service := range project.Services { for name, service := range project.Services {
imageName := api.GetImageNameOrDefault(service, project.Name) imageName := api.GetImageNameOrDefault(service, project.Name)
inspect, err := inspectWithPull(ctx, cli, imageName) inspect, err := inspectWithPull(ctx, dockerCLI, imageName)
if err != nil { if err != nil {
return nil, err return nil, err
} }