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

tour: Suggestion: switch case indention 🫡 #1661

Open
D50000 opened this issue Oct 26, 2024 · 0 comments
Open

tour: Suggestion: switch case indention 🫡 #1661

D50000 opened this issue Oct 26, 2024 · 0 comments

Comments

@D50000
Copy link

D50000 commented Oct 26, 2024

Context: https://go.dev/tour/methods/16

func do(i interface{}) {
	switch v := i.(type) {
	case int:
		fmt.Printf("Twice %v is %v\n", v, v*2)
	case string:
		fmt.Printf("%q is %v bytes long\n", v, len(v))
	default:
		fmt.Printf("I don't know about type %T!\n", v)
	}
}

I am curious about the indention of switch case, after format I thought it will be like this:

func do(i interface{}) {
	switch v := i.(type) {
	    case int:
		    fmt.Printf("Twice %v is %v\n", v, v*2)
	    case string:
		    fmt.Printf("%q is %v bytes long\n", v, len(v))
	    default:
		    fmt.Printf("I don't know about type %T!\n", v)
	}
}

Is that intention or any other special purpose? or future update will it re-indention?

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

1 participant