Home  >  Q&A  >  body text

golang - 用IDE看docker源码时的小问题

用了intellij + golang插件,配置好GO SDK和项目为GO项目后,把project的GOPATH设到了vendor目录

发现import中很多还是红色的,从github clone下来的项目verdor/src并不全,不知道是不是我操作有问题,通过go get拿全了src后,import下就全绿了,没问题。

但是还是有极少数的几个地方是红的,比如container/container.go,daemon/daemon.go

找不到其定义的位置,请教是IDE问题还是我设置问题,或者是别的什么,谢谢

过去多啦不再A梦过去多啦不再A梦2757 days ago615

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-04-25 09:04:23

    I solved the problem as soon as I mentioned it. It was because the system was not selected in the build tag. I just set it to Linux, but the default one didn’t work.
    The file can be modified under the .idea project iml.

    <buildTags>
        <option name="os" value="linux" />
    </buildTags>

    The reason is because there are multiple Container structs in the container directory, container_solaris/container_unix/container_windows. Without setting os, the IDE will not know which struct to use

    reply
    0
  • Cancelreply