mergo icon indicating copy to clipboard operation
mergo copied to clipboard

reflect.Value.Set using unaddressable value

Open darccio opened this issue 3 years ago • 1 comments

From https://github.com/docker/cli/issues/1981:

Description

We are trying to deploy a stack with 2 docker-compose file, the second one overriding volume settings. The stack deploy command fails with a reflect.Value.Set using unaddressable value error.

Steps to reproduce the issue:

  1. Create docker-compose.yml file with the following content:
version: '3.4'
volumes:
  app:
services:
  bash:
    image: bash
    command: cat docker-compose.override.yml
    volumes:
      - app:/app
    working_dir: /app
  1. Create docker-compose.override.yml file with the following content:
version: '3.4'
volumes:
  app:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: $PWD
  1. Deploy a stack with the following command:
docker stack deploy --compose-file docker-compose.yml --compose-file docker-compose.override.yml test

Describe the results you received: The command fails with :

panic: reflect: reflect.Value.Set using unaddressable value

goroutine 1 [running]:
reflect.flag.mustBeAssignable(0x95)
        /usr/local/go/src/reflect/value.go:234 +0x15e
reflect.Value.Set(0x5623e2feee80, 0xc4200bd150, 0x95, 0x5623e2feee80, 0xc420815b30, 0x15)
        /usr/local/go/src/reflect/value.go:1367 +0x31
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e2feee80, 0xc4200bd150, 0x95, 0x5623e2feee80, 0xc4200bd100, 0x95, 0xc42067f5a8, 0x2, 0xc4202adca0, 0x0, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:83 +0xe92
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e3162600, 0xc4200bd130, 0x99, 0x5623e3162600, 0xc4200bd0e0, 0x99, 0xc42067f5a8, 0x1, 0xc4202adca0, 0x0, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:72 +0x1bf6
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e2fea020, 0xc42046d220, 0x195, 0x5623e2fea020, 0xc42046d228, 0x195, 0xc42067f5a8, 0x0, 0xc4202adca0, 0x195, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:115 +0x6ee
github.com/docker/cli/vendor/github.com/imdario/mergo._map(0x5623e2f12a80, 0xc42046d220, 0x5623e2f12a80, 0xc42046d228, 0xc42067f7a8, 0x1, 0x1, 0x1, 0xc42046d228)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/map.go:159 +0x38d
github.com/docker/cli/vendor/github.com/imdario/mergo.Map(0x5623e2f12a80, 0xc42046d220, 0x5623e2f12a80, 0xc42046d228, 0xc42067f7a8, 0x1, 0x1, 0x1, 0xc4203285f8)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/map.go:132 +0x73
github.com/docker/cli/cli/compose/loader.mergeVolumes(0xc42047b3e0, 0xc420815500, 0x1, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/compose/loader/merge.go:216 +0xd3
github.com/docker/cli/cli/compose/loader.merge(0xc420827640, 0x2, 0x2, 0x1, 0x2, 0xc420827640)
        /go/src/github.com/docker/cli/cli/compose/loader/merge.go:31 +0x14f
github.com/docker/cli/cli/compose/loader.Load(0xc42032872b, 0x3, 0xc420042080, 0x28, 0xc4205a0540, 0x2, 0x2, 0xc4205a0570, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/compose/loader/loader.go:111 +0x661
github.com/docker/cli/cli/command/stack/loader.LoadComposefile(0x5623e329a820, 0xc42039bb00, 0x0, 0x0, 0xc4202aca80, 0x2, 0x2, 0x7ffc5e25c0b7, 0x4, 0x5623e2839243, ...)
        /go/src/github.com/docker/cli/cli/command/stack/loader/loader.go:28 +0x18e
github.com/docker/cli/cli/command/stack.newDeployCommand.func1(0xc4204c3b80, 0xc4205005f0, 0x1, 0x5, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/stack/deploy.go:49 +0x23d
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc4204c3b80, 0xc42003a0b0, 0x5, 0x5, 0xc4204c3b80, 0xc42003a0b0)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x46a
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200eca00, 0xc420503fa0, 0x5623e2f546c0, 0xc420503fb0)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x30c
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200eca00, 0xc4200eca00, 0x5623e325b760)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800 +0x2d
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:180 +0xde

Describe the results you expected: The test stack should be deployed correctly.

darccio avatar Jul 30 '20 08:07 darccio

Thanks for opening a new issue. The team has been notified and will review it as soon as possible. For urgent issues and priority support, visit https://xscode.com/imdario/mergo

xscode-auto-reply[bot] avatar Jul 30 '20 08:07 xscode-auto-reply[bot]

Closing in favour of #162

darccio avatar Sep 11 '23 13:09 darccio