dsf4354353452 2018-08-20 10:43
浏览 190
已采纳

运行带有dep的vet时找不到头文件

I get this error when running go vet in my project, with vendored dependencies.

$ go vet ./...
# <project path...>/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:10: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory
 #include "libsecp256k1/include/secp256k1.h"

I thought that this was a dependency missing in the development environment, but when looking at the original project source, the include path is relative to the source file.

Why can the file not be found?

  • 写回答

2条回答 默认 最新

  • duanchendu69495 2018-08-20 10:43
    关注

    Some dependency management tools for go do not vendor all code that is referenced by the project. This means that in some circumstances C code, that can be used in go files with cgo, are not included in the vendor directory.

    I have encountered this issue twice with two separate vendoring tools, but there is work to support these use cases.

    The simplest method I have found so far is to use govendor and then import the complete directory to ensure that all the required files are there. This is a very simple solution that ignores a lot of the complexity around including c dependencies in go projects, but fixes the issue whilst there is no permanent fix for the issue.

    go get github.com/kardianos/govendor
    govendor init
    govendor add +e
    # Remove the directory that is missing the c dependencies
    rm -rf ./vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/
    # Add the file and include all files
    # https://github.com/kardianos/govendor/issues/247
    govendor add github.com/ethereum/go-ethereum/crypto/secp256k1/^
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失