从github导入使用本机C代码的go软件包

时间:2019-01-25 07:14:31

标签: go

我正在编写一些需要从另一个GitHub存储库访问Cobra CLI对象的代码:

package main

import (
    "github.com/spf13/cobra/doc"
    "github.com/sylabs/singularity/cmd/singularity/cli"
    "log"
)

func main() {
    err := doc.GenReSTTree(cli.SingularityCmd, "./")
    if err != nil {
        log.Fatal(err)
    }
}

我还具有以下版本限制:

[[constraint]]
  name = "github.com/sylabs/singularity"
  version = "3.0.3"

现在,当我go install时,出现错误:

# github.com/TMiguelT/singularity-userdocs/vendor/github.com/sylabs/singularity/internal/pkg/runtime/engines/config/starter
vendor/github.com/sylabs/singularity/internal/pkg/runtime/engines/config/starter/starter.go:10:10: fatal error: starter.h: No such file or directory
 #include "starter.h"
          ^~~~~~~~~~~
compilation terminated.

因此,当我尝试构建代码时,它会尝试编译奇异模块并失败,因为它找不到某些C代码。该头文件位于我要导入的存储库中:https://github.com/sylabs/singularity/blob/v3.0.3/cmd/starter/c/starter.h

如何使go install意识到这一点,以确保我的项目可以编译?

0 个答案:

没有答案