summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-02-16 17:24:06 +0100
committerGitHub <noreply@github.com>2022-02-16 17:24:06 +0100
commitd0a1919bd2f61c5674eb1fd2ee996f76904187a6 (patch)
tree8b675472e13680eb017b97908584fcb64fe0181e /pkgs
parentcacc35350a91dd1c1f37fb6f25736e21e8e6b74b (diff)
parentaa5baf4dc3049cdbdbabb41e920bcce0f3a95fdc (diff)
downloadnixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar.gz
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar.bz2
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar.lz
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar.xz
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.tar.zst
nixpkgs-d0a1919bd2f61c5674eb1fd2ee996f76904187a6.zip
Merge pull request #160180 from aaronjheng/bingo
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/bingo/default.nix41
-rw-r--r--pkgs/development/tools/bingo/version_go.patch17
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/development/tools/bingo/default.nix b/pkgs/development/tools/bingo/default.nix
new file mode 100644
index 00000000000..8fe1dbaa4be
--- /dev/null
+++ b/pkgs/development/tools/bingo/default.nix
@@ -0,0 +1,41 @@
+{ lib, buildGoModule, fetchFromGitHub, testVersion, bingo }:
+
+buildGoModule rec {
+  pname = "bingo";
+  version = "0.5.2";
+
+  src = fetchFromGitHub {
+    owner = "bwplotka";
+    repo = "bingo";
+    rev = "v${version}";
+    sha256 = "sha256-4D8YaA/AH1gIp5iwD7WEAdBl73sqwHpfOe7bnxVcRcw=";
+  };
+
+  vendorSha256 = "sha256-xrz9FpwZd+FboVVTWSqGHRguGwrwE9cSFEEtulzbfDQ=";
+
+  patches = [
+    # Do not execute `go` command when invoking `bingo version`.
+    ./version_go.patch
+  ];
+
+  postPatch = ''
+    rm get_e2e_test.go get_e2e_utils_test.go
+  '';
+
+  CGO_ENABLED = 0;
+
+  ldflags = [ "-s" "-w" ];
+
+  passthru.tests.version = testVersion {
+    package = bingo;
+    command = "bingo version";
+    version = "v${version}";
+  };
+
+  meta = with lib; {
+    description = "Like `go get` but for Go tools! CI Automating versioning of Go binaries in a nested, isolated Go modules.";
+    homepage = "https://github.com/bwplotka/bingo";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ aaronjheng ];
+  };
+}
diff --git a/pkgs/development/tools/bingo/version_go.patch b/pkgs/development/tools/bingo/version_go.patch
new file mode 100644
index 00000000000..2898326a054
--- /dev/null
+++ b/pkgs/development/tools/bingo/version_go.patch
@@ -0,0 +1,17 @@
+diff --git a/main.go b/main.go
+index 5600f7e..662ed1b 100644
+--- a/main.go
++++ b/main.go
+@@ -201,10 +201,8 @@ func main() {
+ 			return pkgs.PrintTab(target, os.Stdout)
+ 		}
+ 	case "version":
+-		cmdFunc = func(ctx context.Context, r *runner.Runner) error {
+-			_, err := fmt.Fprintln(os.Stdout, version.Version)
+-			return err
+-		}
++		_, _ = fmt.Fprintln(os.Stdout, version.Version)
++		return
+ 	default:
+ 		exitOnUsageError(flags.Usage, "No such command", flags.Arg(0))
+ 	}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 932009fd70c..e6ef604a969 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -216,6 +216,8 @@ with pkgs;
 
   beyond-identity = callPackage ../tools/security/beyond-identity {};
 
+  bingo = callPackage ../development/tools/bingo {};
+
   breakpad = callPackage ../development/misc/breakpad { };
 
   buf = callPackage ../development/tools/buf { };