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

cmd/gofmt: strange indentation of +-separated args #13800

Closed
cespare opened this issue Jan 2, 2016 · 3 comments
Closed

cmd/gofmt: strange indentation of +-separated args #13800

cespare opened this issue Jan 2, 2016 · 3 comments

Comments

@cespare
Copy link
Contributor

cespare commented Jan 2, 2016

This indentation seems strange:

b := []byte(
    "foo" +
        "bar" +
        "baz",
)

(See playground here.)

Not sure whether this is a bug or some weird corner case. I would've expected

b := []byte(
    "foo" +
    "bar" +
    "baz",
)

/cc @griesemer

@minux
Copy link
Member

minux commented Jan 2, 2016 via email

@cespare
Copy link
Contributor Author

cespare commented Jan 2, 2016

Oh, right. It's the same as

b := []byte(
    foo(
        "bar"),
)

@cespare cespare closed this as completed Jan 2, 2016
@dsnet
Copy link
Member

dsnet commented Jan 3, 2016

If you really cared about alignment (for readability reasons or something). You could do an empty string on the first line:

hex := []byte("" +
    "0123456789abcdef" +
    "0123456789abcdef" +
    "0123456789abcdef" +
    "0123456789abcdef" +
    "0123456789abcdef")

@golang golang locked and limited conversation to collaborators Jan 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants