2022-06-07 21:41:37 +00:00
|
|
|
{ buildGoModule, fetchFromGitHub, lib }:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "revive";
|
2024-01-04 04:49:00 +00:00
|
|
|
version = "1.3.5";
|
2022-06-07 21:41:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mgechev";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-01-04 04:49:00 +00:00
|
|
|
sha256 = "sha256-yHsEELeBG/dgV1uaYTOfvVVZQZ+AG1kKx86tn9GI+RA=";
|
2022-06-07 21:41:37 +00:00
|
|
|
# populate values that require us to use git. By doing this in postFetch we
|
|
|
|
# can delete .git afterwards and maintain better reproducibility of the src.
|
|
|
|
leaveDotGit = true;
|
|
|
|
postFetch = ''
|
|
|
|
date -u -d "@$(git -C $out log -1 --pretty=%ct)" "+%Y-%m-%d %H:%M UTC" > $out/DATE
|
|
|
|
git -C $out rev-parse HEAD > $out/COMMIT
|
|
|
|
rm -rf $out/.git
|
|
|
|
'';
|
|
|
|
};
|
2024-01-04 04:49:00 +00:00
|
|
|
vendorHash = "sha256-hNLHVx3zuCheSfY6TSixfJj/76JQ9nOW+mBquIZCgSk=";
|
2022-06-07 21:41:37 +00:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/mgechev/revive/cli.version=${version}"
|
|
|
|
"-X github.com/mgechev/revive/cli.builtBy=nix"
|
|
|
|
];
|
|
|
|
|
|
|
|
# ldflags based on metadata from git and source
|
|
|
|
preBuild = ''
|
|
|
|
ldflags+=" -X github.com/mgechev/revive/cli.commit=$(cat COMMIT)"
|
|
|
|
ldflags+=" -X 'github.com/mgechev/revive/cli.date=$(cat DATE)'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# The following tests fail when built by nix:
|
|
|
|
#
|
2024-01-04 04:49:00 +00:00
|
|
|
# $ nix log /nix/store/build-revive.1.3.5.drv | grep FAIL
|
2022-06-07 21:41:37 +00:00
|
|
|
#
|
|
|
|
# --- FAIL: TestAll (0.01s)
|
|
|
|
# --- FAIL: TestTimeEqual (0.00s)
|
|
|
|
# --- FAIL: TestTimeNaming (0.00s)
|
|
|
|
# --- FAIL: TestUnhandledError (0.00s)
|
|
|
|
# --- FAIL: TestUnhandledErrorWithBlacklist (0.00s)
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast, configurable, extensible, flexible, and beautiful linter for Go";
|
|
|
|
homepage = "https://revive.run";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ maaslalani ];
|
|
|
|
};
|
|
|
|
}
|