douqi4673 2018-09-01 10:57
浏览 308

Golang的Delve找不到位于父文件夹中的软件包

Problem: I'm using gb to build the project. It recursively checks all folders to get vendor, external and main.go files. Delve doesn't do this so when I ssh into the docker image and try to run the dlv server on the root of the project it says that it cannot find go files. If I try with src/cmd/project/main.go it says it cannot find all the other packages.

  1. What version of Delve are you using (dlv version)? dlv1.1.0
  2. What version of Go are you using? (go version)? go1.9.2
  3. What operating system and processor architecture are you using? Docker 18.06.1-ce in Mint 19
  4. What did you do? dlv debug src/cmd/project/main.go-l 0.0.0.0:2345 --headless=true --log=true -- server
  5. What did you expect to see? Delve running
  6. What did you see instead?

    src/cmd/project/main.go:4:2: cannot find package "external/nexudus" in any of: /usr/local/go/src/external/nexudus (from $GOROOT) /go/src/external/nexudus (from $GOPATH) src/cmd/project/main.go:8:2: cannot find package "github.com/jinzhu/gorm" in any of: /usr/local/go/src/github.com/jinzhu/gorm (from $GOROOT) /go/src/github.com/jinzhu/gorm (from $GOPATH) src/cmd/project/main.go:9:2: cannot find package "gopkg.in/intercom/intercom-go.v2" in any of: /usr/local/go/src/gopkg.in/intercom/intercom-go.v2 (from $GOROOT) /go/src/gopkg.in/intercom/intercom-go.v2 (from $GOPATH) exit status 1

  7. EXTRA My configuration file (docker/web-dev): ...

    VOLUME /project/app/contracts

    VOLUME /project/pkg

    VOLUME /project/src

    VOLUME /project/vendor

My docker-compose file:

web:

  build: .

  dockerfile: docker/web-dev

  working_dir: /project

  command: /go/bin/reflex --regex='\.go$$' --inverse-regex='_test\.go$$' --start-service -- sh -c 'gb build all && ./bin/project server'

  ports:

  - 6262:6262

  volumes:

  - ./pkg:/project/pkg

  - ./src:/project/src

  - ./vendor:/project/vendor

  - ./app:/project/app

  - ./app/contracts:/project/app/contracts
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
    • ¥20 yolov5自定义Prune报错,如何解决?