unix NIX - go:模块被GO 111 MODULE =off禁用;

m0rkklqb  于 2023-02-04  发布在  Unix
关注(0)|答案(1)|浏览(427)

我正在尝试使用nix下载并构建一个用golang编写的项目
我的nix文件:

buildGoPackage {      
  name = "site";     
  goPackagePath = "git@github.com:username/rep.git";    
  src = fetchGit{      
       url = "git@github.com:username/rep.git";     
  }; 
}

运行:

nix build -f test3.nix

错误日志:

last 8 log lines:        
 > unpacking sources       
 > unpacking source archive /nix/store/l1gsllgg693s46sk7b7qiwbnjysnbbz6-source        
 > source root is source        
 > patching sources        
 > configuring       
 > building        
 > Building subPackage git@github.com:user/rep.git        
 > go: modules disabled by GO111MODULE=off; see 'go help modules'
fcipmucu

fcipmucu1#

我认为您应该使用buildGoModule而不是buildGoPackage,因为根据the nixpkgs documentation for go,buildGoPackage已被弃用。
此外,buildGoModule似乎没有设置GO111MODULE=off

相关问题