<commit_before>{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, runCommand
, nix-update-script
, dsq
, testVersion
, diffutils
}:

buildGoModule rec {
  pname = "dsq";
  version = "0.14.0";

  src = fetchFromGitHub {
    owner = "multiprocessio";
    repo = "dsq";
    rev = version;
    hash = "sha256-BhWcl0yMpTi/6+dFk6wX/rMkH1k9m9eVm40iNwZGrJM=";
  };

  vendorSha256 = "sha256-mSF2oNdTKAg3iRejKkn24hSCJDM6iOkRMruic73ceX4=";

  nativeBuildInputs = [ diffutils ];

  ldflags = [ "-X" "main.Version=${version}" ];

  passthru = {
    updateScript = nix-update-script { attrPath = pname; };

    tests = {
      version = testVersion { package = dsq; };

      pretty-csv = runCommand "${pname}-test" { } ''
        mkdir "$out"
        cat <<EOF > "$out/input.csv"
        first,second
        1,a
        2,b
        EOF
        cat <<EOF > "$out/expected.txt"
        +-------+--------+
        | first | second |
        +-------+--------+
        |     1 | a      |
        |     2 | b      |
        +-------+--------+
        EOF<commit_msg>dsq: 0.14.0 -> 0.15.1<commit_after>{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, runCommand
, nix-update-script
, dsq
, testVersion
, diffutils
}:

buildGoModule rec {
  pname = "dsq";
  version = "0.15.1";

  src = fetchFromGitHub {
    owner = "multiprocessio";
    repo = "dsq";
    rev = version;
    hash = "sha256-AT5M3o1cvRIZyyA28uX+AI4p9I3SzX3OCdBcIFGKspw=";
  };

  vendorSha256 = "sha256-<KEY>;

  nativeBuildInputs = [ diffutils ];

  ldflags = [ "-X" "main.Version=${version}" ];

  passthru = {
    updateScript = nix-update-script { attrPath = pname; };

    tests = {
      version = testVersion { package = dsq; };

      pretty-csv = runCommand "${pname}-test" { } ''
        mkdir "$out"
        cat <<EOF > "$out/input.csv"
        first,second
        1,a
        2,b
        EOF
        cat <<EOF > "$out/expected.txt"
        +-------+--------+
        | first | second |
        +-------+--------+
        |     1 | a      |
        |     2 | b      |
        +-------+--------+
        EOF
{'fraction_non_alphanumeric': 0.18520309477756286, 'fraction_numerical': 0.03239845261121857, 'mean_word_length': 1.747675962815405, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1055676', 'n_tokens_mistral': 816, 'n_tokens_neox': 763, 'n_words': 131}