Skip to content

Instantly share code, notes, and snippets.

@yudai
Created February 7, 2014 05:32
Show Gist options
  • Select an option

  • Save yudai/8857785 to your computer and use it in GitHub Desktop.

Select an option

Save yudai/8857785 to your computer and use it in GitHub Desktop.
which do you like?
#1
obj.method0(
arg1,
arg2)
.method1
.method2
#2
obj.method0(
arg1,
arg2).method1
.method2
#3
obj.method0(
arg1,
arg2
)
.method1
.method2
#4
obj.method0(
arg1,
arg2
).method1
.method2
@yuitsubasapapa
Copy link
Copy Markdown

どれかを、選択しなければいけないなら、#1かなぁ
でも、

obj.method0(
   arg1,
   arg2,
).
  method1.
  method2

は、意図がはっきりしていていいかも

@kokuboyuichi
Copy link
Copy Markdown

この中なら、#4で

@nsnt
Copy link
Copy Markdown

nsnt commented Feb 7, 2014

gofmtだと,行を長いまま放置しない場合は,

    obj.method0(
        longlonglonglonglognlonglonglonglongarg1,
        longlonglonglonglognlonglonglonglongarg2,
    ).
        longlonglonglonglognlonglonglonglongmethod1.
        longlonglonglonglognlonglonglonglongmethod2

が基本みたいです。
().longlonglonglonglognlonglonglonglongmethod1.とかは許されると思いますが)
ちなみに()内の2行目の最後の,は必須です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment