Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Handling of closing parenthesis on function calls #278

Closed
matthewhughes934 opened this issue Jul 23, 2023 · 2 comments
Closed

Feature: Handling of closing parenthesis on function calls #278

matthewhughes934 opened this issue Jul 23, 2023 · 2 comments

Comments

@matthewhughes934
Copy link

Hi, thanks for creating this tool.

I was wondering if there were any plans, or existing discussions (I didn't see any with a quick search of the issues on this repo) around handling the location of closing parenthesis for function calls.

To demonstrate my thoughts:

package pkg

func f() {
	s := []string{
		"foo",
		"bar"}

	m := map[string]int{
		"foo": 1,
		"bar": 2,}

	foo(
		"wat",
		"hmm",
		"something",)

	foo(
		"wat",
		"hmm",
		"something",
	)
}

The result of diff -U1 file.go <(gofumpt file.go):

@@ -5,3 +5,4 @@
 		"foo",
-		"bar"}
+		"bar",
+	}
 
@@ -9,3 +10,4 @@
 		"foo": 1,
-		"bar": 2,}
+		"bar": 2,
+	}
 
@@ -14,3 +16,3 @@
 		"hmm",
-		"something",)
+		"something")

So for the slice and map instance, the closing brace is forced on a newline with a trailing comma added as need. What do you think about making this also be the case for the closing parenthesis on multi-line function calls? So that both calls to foo above would be formatted as:

	foo(
		"wat",
		"hmm",
		"something",
	)
@matthewhughes934 matthewhughes934 changed the title Handling of closing parenthesis on function calls Feature: Handling of closing parenthesis on function calls Jul 25, 2023
@mvdan
Copy link
Owner

mvdan commented Jul 28, 2023

Duplicate of #74 :) See the discussion there, and feel free to leave a comment if you have anything to add.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2023
@matthewhughes934
Copy link
Author

Duplicate of #74 :)

Ah thanks, looks like my search-fu skills were lacking

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

No branches or pull requests

2 participants