Skip to content

Indentation of empty case places ;; in the same line as the case #1289

Closed

Description

@guillemj

Hi!

With the following test file:

#!/bin/sh

case "$1" in
first)
  ;;
second)
  echo "here"
  ;;
esac

Running shfmt produces:

#!/bin/sh

case "$1" in
first) ;;
second)
        echo "here"
        ;;
esac

Which places the ;; in the same line as the case. This means that when you want to add content to that "first" case, you need to modify that line and split it into two, which produces unnecessary diff(1) or git-diff(1) changes.

(I skimmed over the other tickets and didn't see this being filed already, but might have missed some perhaps.)

Activity

  1. mvdan commented on Mar 14, 2026

    @mvdan
    Owner

    Thanks for the suggestion, that's reasonable. I'll take a look.

  2. added a commit that references this issue on Mar 17, 2026
    781257a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址