package api import ( "os" "os/exec" "path/filepath" "runtime" "strings" "testing" ) func goCmd() string { var exeSuffix string if runtime.GOOS == "windows" { exeSuffix = ".exe" } path := filepath.Join(runtime.GOROOT(), "bin", "go"+exeSuffix) if _, err := os.Stat(path); err == nil { return path } return "go" } func TestDoesntDependOnFFI(t *testing.T) { deps, err := exec.Command(goCmd(), "list", "-deps", "github.com/filecoin-project/lotus/api").Output() if err != nil { t.Fatal(err) } for _, pkg := range strings.Fields(string(deps)) { if pkg == "github.com/filecoin-project/filecoin-ffi" { t.Fatal("api depends on filecoin-ffi") } } }