Skip to content

feat: Add missing newlines and add flag --no-trailing-newline port https://github.com/google/go-jsonnet/pull/843#613

Merged
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:newlines
Feb 27, 2026
Merged

feat: Add missing newlines and add flag --no-trailing-newline port https://github.com/google/go-jsonnet/pull/843#613
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:newlines

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Feb 27, 2026

refs: #592

Copilot AI review requested due to automatic review settings February 27, 2026 13:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports the --no-trailing-newline flag from upstream jsonnet implementations (google/go-jsonnet and google/jsonnet) to sjsonnet. By default, sjsonnet now adds trailing newlines to output (both stdout and files in multi mode), and the new flag allows users to suppress these trailing newlines. This brings sjsonnet's behavior in line with other jsonnet implementations.

Changes:

  • Added --no-trailing-newline flag to suppress trailing newlines in output
  • Updated default behavior to add trailing newlines to multi-mode file outputs
  • Added validation to prevent using the flag with --yaml-stream mode

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sjsonnet/src-jvm-native/sjsonnet/Config.scala Adds the noTrailingNewline flag configuration parameter
sjsonnet/src-jvm-native/sjsonnet/SjsonnetMainBase.scala Implements the flag logic for stdout, file writing, and yaml output; adds validation to reject the flag with yaml-stream
sjsonnet/test/src-jvm/sjsonnet/MainTests.scala Updates existing tests to expect trailing newlines and adds comprehensive tests for the new flag across different output modes
sjsonnet/test/resources/db/multi_string.jsonnet Adds test resource file for multi-file string output tests
readme.md Documents the new --no-trailing-newline flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stephenamar-db stephenamar-db merged commit d9e3939 into databricks:master Feb 27, 2026
12 checks passed
@He-Pin He-Pin deleted the newlines branch February 27, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants