From a0ed002ba96278b08b35e49844c5252539e761b1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 12 May 2022 22:49:54 +0200 Subject: [PATCH] Fix build --- src/libexpr/flake/lockfile.cc | 9 +++------ src/libexpr/flake/lockfile.hh | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc index a34cfde97..b9caad92d 100644 --- a/src/libexpr/flake/lockfile.cc +++ b/src/libexpr/flake/lockfile.cc @@ -66,8 +66,10 @@ std::shared_ptr LockFile::findInput(const InputPath & path) return pos; } -LockFile::LockFile(const nlohmann::json & json, std::string_view path) +LockFile::LockFile(std::string_view contents, std::string_view path) { + auto json = nlohmann::json::parse(contents); + auto version = json.value("version", 0); if (version < 5 || version > 7) throw Error("lock file '%s' has unsupported version %d", path, version); @@ -116,11 +118,6 @@ LockFile::LockFile(const nlohmann::json & json, std::string_view path) // a bit since we don't need to worry about cycles. } -LockFile::LockFile(std::string_view contents, std::string_view path) - : LockFile(nlohmann::json::parse(contents), path) -{ -} - nlohmann::json LockFile::toJSON() const { nlohmann::json nodes; diff --git a/src/libexpr/flake/lockfile.hh b/src/libexpr/flake/lockfile.hh index d51bdb86d..14210cfc9 100644 --- a/src/libexpr/flake/lockfile.hh +++ b/src/libexpr/flake/lockfile.hh @@ -50,7 +50,6 @@ struct LockFile std::shared_ptr root = std::make_shared(); LockFile() {}; - LockFile(const nlohmann::json & json, std::string_view path); LockFile(std::string_view contents, std::string_view path); nlohmann::json toJSON() const;