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

Long list of switch/case options: Split to block (not each on new line). #159

Open
guettli opened this issue Jan 20, 2025 · 1 comment
Open

Comments

@guettli
Copy link

guettli commented Jan 20, 2025

Orig:

package main

func main() {
	serverType := "dummy"
	switch serverType {
	case "cpx11", "cx21", "cpx21", "cx31", "cpx31", "cx41", "cpx41", "cx51", "cpx51", "ccx11", "ccx12", "ccx13", "ccx21", "ccx22", "ccx23", "ccx31", "ccx32", "ccx33", "ccx41", "ccx42", "ccx43", "ccx51", "ccx52", "ccx53", "ccx62", "ccx63", "cax11", "cax21", "cax31", "cax41", "cx22", "cx32", "cx42", "cx52":
		return
	default:
		return
	}
}

After golines:

package main

func main() {
	serverType := "dummy"
	switch serverType {
	case "cpx11",
		"cx21",
		"cpx21",
		"cx31",
		"cpx31",
		"cx41",
		"cpx41",
		"cx51",
		"cpx51",
		"ccx11",
		"ccx12",
		"ccx13",
		"ccx21",
		"ccx22",
		"ccx23",
		"ccx31",
		"ccx32",
		"ccx33",
		"ccx41",
		"ccx42",
		"ccx43",
		"ccx51",
		"ccx52",
		"ccx53",
		"ccx62",
		"ccx63",
		"cax11",
		"cax21",
		"cax31",
		"cax41",
		"cx22",
		"cx32",
		"cx42",
		"cx52":
		return
	default:
		return
	}
}

I would prefer something like this:

package main

func main() {
	serverType := "dummy"
	switch serverType {
	case "cpx11", "cx21", "cpx21", "cx31", "cpx31", "cx41", "cpx41", "cx51", "cpx51", "ccx11",
		"ccx12", "ccx13", "ccx21", "ccx22", "ccx23", "ccx31", "ccx32", "ccx33", "ccx41", "ccx42",
		"ccx43", "ccx51", "ccx52", "ccx53", "ccx62", "ccx63", "cax11", "cax21", "cax31", "cax41",
		"cx22", "cx32", "cx42", "cx52":
		return
	default:
		return
	}
}
@ccoVeille
Copy link

Mee too😅

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