Skip to content

Commit

Permalink
lock: write lock file with final newline (#1057)
Browse files Browse the repository at this point in the history
* lock: write lock file with final newline

Before this commit, `nimble lock` wrote the lock file without a final
newline:

    $ nimble lock
         Info:  Generating the lock file...
      Verifying dependencies for foo@0.1.0
      Success:  The lock file is generated.
    $ cat nimble.lock
    {
      "version": 1,
      "packages": {}
    $ wc -l nimble.lock
    3 nimble.lock

Fixes: #1056

* Update src/nimblepkg/lockfile.nim

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
  • Loading branch information
ee7 and Araq authored Jan 31, 2023
1 parent fcb4c9d commit c701d6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nimblepkg/lockfile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ proc writeLockFile*(fileName: string, packages: LockFileDeps,
$lfjkPackages: packagesJsonNode
}

writeFile(fileName, mainJsonNode.pretty)
var s = mainJsonNode.pretty
s.add '\n'
writeFile(fileName, s)

proc readLockFile*(filePath: string): LockFileDeps =
{.warning[UnsafeDefault]: off.}
Expand Down

0 comments on commit c701d6e

Please sign in to comment.