go - 在 nix 中使用 buildGoPackage 时出现“没有这样的文件或目录”错误

标签 go nix

我正在尝试构建 hasura cli:https://github.com/hasura/graphql-engine/tree/master/cli使用以下代码(从 dep2nix 派生的 dep):

{ buildGoPackage, fetchFromGitHub }:

buildGoPackage rec {
  version = "1.0.0-beta.2";
  name = "hasura-${version}";

  goPackagePath = "github.com/hasura/graphql-engine";
  subPackages = [ "cli" ];

  src = fetchFromGitHub {
    owner = "hasura";
    repo = "graphql-engine";
    rev = "v${version}";
    sha256 = "1b40s41idkp1nyb9ygxgsvrwv8rsll6dnwrifpn25bvnfk8idafr";
  };

  goDeps = ./deps.nix; 
}

但在安装后修复步骤后出现以下错误: 查找:'/nix/store/gkck68cm2z9k1qxgmh350pq3kwsbyn8q-hasura-cli-1.0.0-beta.2':没有这样的文件或目录

我在这里做错了什么?作为引用,我在 macOS 上使用家庭管理器。

最佳答案

对于任何仍然想知道的人:

有几件事需要考虑:

  1. dep has been deprecated支持 go 模块
  2. 这也反射(reflect)在 Nix 中,因为 buildGoPackagenow legacy并移动到 buildGoModule
  3. nixpkgs 中已经有一个 hasura-cli 包。您可以将它与 nix-shell -p hasura-cli
  4. 一起使用

关于go - 在 nix 中使用 buildGoPackage 时出现“没有这样的文件或目录”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56981657/

相关文章:

go - 如何在 map[string]string 中读取 *redis.Client.TxPipeline.Exec() 方法的响应

Golang rest api并发

haskell - 如何使用 haskell 堆栈创建一个 nix 包

linux - 如何在 configuration.nix 中添加 linux 配置

php - 通过 Nix flake 安装时,Composer 读取的 PHP 版本不正确

virtualbox - 在 configuration.nix 中从 nixos-unstable 安装 virtualbox 模块

Golang - 内部结构如何实现?

mongodb - Go 和 MongoDb 错误 : has no field or method

go - 引用解析器 Golang : Production setting instead of using placeholder value?

scala - 在 macOS Sierra 上使用 Nix 安装 Scala