about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Jheng <wentworth@outlook.com>2023-02-28 07:38:40 +0000
committerAaron Jheng <wentworth@outlook.com>2023-02-28 07:40:10 +0000
commitef5dc1f99490f24a6b367222fa590d8d91bca4c7 (patch)
treed511160dc1de9acf72306e948e5d7f266cd29f85
parent17c86704733b93dd1251e77d53f4d0569550a8ff (diff)
jid: Use buildGoModule
-rw-r--r--pkgs/development/tools/jid/default.nix22
-rw-r--r--pkgs/development/tools/jid/deps.nix75
-rw-r--r--pkgs/development/tools/jid/go-mod.patch79
3 files changed, 95 insertions, 81 deletions
diff --git a/pkgs/development/tools/jid/default.nix b/pkgs/development/tools/jid/default.nix
index b48de54dd22e3..c4c891778114c 100644
--- a/pkgs/development/tools/jid/default.nix
+++ b/pkgs/development/tools/jid/default.nix
@@ -1,19 +1,29 @@
-{ lib, buildGoPackage, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, testers, jid }:
 
-buildGoPackage rec {
+buildGoModule rec {
   pname = "jid";
   version = "0.7.6";
 
-  goPackagePath = "github.com/simeji/jid";
-
   src = fetchFromGitHub {
     owner = "simeji";
     repo = "jid";
     rev = "v${version}";
-    sha256 = "15fgi7cpq5bg2lnpr7rip359xwj2kvlj6j2qzi837c26adnw973x";
+    hash = "sha256-fZzEbVNGsDNQ/FhII+meQvKeyrgxn3wtFW8VfNmJz5U=";
   };
 
-  goDeps = ./deps.nix;
+  vendorHash = "sha256-Lq8ouTjPsGhqDwrCMpqkSU7FEGszYwAkwl92vAEZ68w=";
+
+  patches = [
+    # Run go mod tidy
+    ./go-mod.patch
+  ];
+
+  ldflags = [ "-s" "-w" ];
+
+  passthru.tests.version = testers.testVersion {
+    package = jid;
+    version = "v${version}";
+  };
 
   meta = {
     description = "A command-line tool to incrementally drill down JSON";
diff --git a/pkgs/development/tools/jid/deps.nix b/pkgs/development/tools/jid/deps.nix
deleted file mode 100644
index 6e2d5514a838b..0000000000000
--- a/pkgs/development/tools/jid/deps.nix
+++ /dev/null
@@ -1,75 +0,0 @@
-# file generated from go.mod using vgo2nix (https://github.com/adisbladis/vgo2nix)
-[
-  {
-    goPackagePath = "github.com/bitly/go-simplejson";
-    fetch = {
-      type = "git";
-      url = "https://github.com/bitly/go-simplejson";
-      rev = "v0.5.0";
-      sha256 = "0n9f9dz1jn1jx86d48569nznpjn9fmq3knn7r65xpy7jhih284jj";
-    };
-  }
-  {
-    goPackagePath = "github.com/fatih/color";
-    fetch = {
-      type = "git";
-      url = "https://github.com/fatih/color";
-      rev = "v1.7.0";
-      sha256 = "0v8msvg38r8d1iiq2i5r4xyfx0invhc941kjrsg5gzwvagv55inv";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-colorable";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-colorable";
-      rev = "v0.0.9";
-      sha256 = "1nwjmsppsjicr7anq8na6md7b1z84l9ppnlr045hhxjvbkqwalvx";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-isatty";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-isatty";
-      rev = "v0.0.4";
-      sha256 = "0zs92j2cqaw9j8qx1sdxpv3ap0rgbs0vrvi72m40mg8aa36gd39w";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-runewidth";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-runewidth";
-      rev = "v0.0.4";
-      sha256 = "00b3ssm7wiqln3k54z2wcnxr3k3c7m1ybyhb9h8ixzbzspld0qzs";
-    };
-  }
-  {
-    goPackagePath = "github.com/nsf/termbox-go";
-    fetch = {
-      type = "git";
-      url = "https://github.com/nsf/termbox-go";
-      rev = "60ab7e3d12ed";
-      sha256 = "040064fh7wzdmv8flw6svi007hiqs1cjk1a3k3gpg7gii3npifsl";
-    };
-  }
-  {
-    goPackagePath = "github.com/nwidger/jsoncolor";
-    fetch = {
-      type = "git";
-      url = "https://github.com/nwidger/jsoncolor";
-      rev = "75a6de4340e5";
-      sha256 = "0aiv42xijrqgrxfx6pfyrndpwqv8i1qwsk190jdczyjxlnki2nki";
-    };
-  }
-  {
-    goPackagePath = "github.com/pkg/errors";
-    fetch = {
-      type = "git";
-      url = "https://github.com/pkg/errors";
-      rev = "v0.8.0";
-      sha256 = "001i6n71ghp2l6kdl3qq1v2vmghcz3kicv9a5wgcihrzigm75pp5";
-    };
-  }
-]
diff --git a/pkgs/development/tools/jid/go-mod.patch b/pkgs/development/tools/jid/go-mod.patch
new file mode 100644
index 0000000000000..beca79fff86a0
--- /dev/null
+++ b/pkgs/development/tools/jid/go-mod.patch
@@ -0,0 +1,79 @@
+diff --git a/go.mod b/go.mod
+index d26c293..3276f36 100644
+--- a/go.mod
++++ b/go.mod
+@@ -1,12 +1,24 @@
+ module github.com/simeji/jid
+ 
++go 1.19
++
+ require (
+ 	github.com/bitly/go-simplejson v0.5.0
+-	github.com/fatih/color v1.7.0 // indirect
+-	github.com/mattn/go-colorable v0.0.9 // indirect
+-	github.com/mattn/go-isatty v0.0.4 // indirect
+ 	github.com/mattn/go-runewidth v0.0.4
+ 	github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed
+ 	github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5
+ 	github.com/pkg/errors v0.8.0
++	github.com/stretchr/testify v1.8.2
++)
++
++require (
++	github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
++	github.com/davecgh/go-spew v1.1.1 // indirect
++	github.com/fatih/color v1.7.0 // indirect
++	github.com/kr/pretty v0.3.1 // indirect
++	github.com/mattn/go-colorable v0.0.9 // indirect
++	github.com/mattn/go-isatty v0.0.4 // indirect
++	github.com/pmezard/go-difflib v1.0.0 // indirect
++	golang.org/x/sys v0.5.0 // indirect
++	gopkg.in/yaml.v3 v3.0.1 // indirect
+ )
+diff --git a/go.sum b/go.sum
+index 2fb379f..07d786d 100644
+--- a/go.sum
++++ b/go.sum
+@@ -1,7 +1,17 @@
+ github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
+ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
++github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
++github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
++github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
++github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
++github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
++github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
+ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
++github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
++github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
++github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
++github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+ github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
+ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+ github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
+@@ -12,5 +22,24 @@ github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylr
+ github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
+ github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5 h1:d+C3xJdxZT7wNlxqEwbXn3R355CwAhYBL9raVNfSnK0=
+ github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5/go.mod h1:GYFm0zZgTNeoK1QxuIofRDasy2ibmaJZhZLzwsMXUF4=
++github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
+ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
++github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
++github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
++github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
++github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
++github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
++github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
++github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
++github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
++github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
++github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
++github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
++golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
++golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
++gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
++gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
++gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
++gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
++gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=