yarpc / yarpc-go

A message passing platform for Go
MIT License
412 stars 103 forks source link

Gofmt complains about YARPC code #391

Closed ascandella closed 7 years ago

ascandella commented 8 years ago
diff examples/keyvalue/kv/yarpc/keyvalueclient/client.go gofmt/examples/keyvalue/kv/yarpc/keyvalueclient/client.go
--- /var/folders/b3/pnm730v50fg2ms_mtbrxkzwc0000gn/T/gofmt129775065 2016-10-24 12:44:16.000000000 -0700
+++ /var/folders/b3/pnm730v50fg2ms_mtbrxkzwc0000gn/T/gofmt308321636 2016-10-24 12:44:16.000000000 -0700
@@ -5,11 +5,11 @@

 import (
    "go.uber.org/fx/examples/keyvalue/kv/service/keyvalue"
-   "golang.org/x/net/context"
+   "go.uber.org/thriftrw/wire"
+   "go.uber.org/yarpc"
    "go.uber.org/yarpc/encoding/thrift"
    "go.uber.org/yarpc/transport"
-   "go.uber.org/yarpc"
-   "go.uber.org/thriftrw/wire"
+   "golang.org/x/net/context"
 )

 // Interface is a client for the KeyValue service.
diff examples/keyvalue/kv/yarpc/keyvalueserver/server.go gofmt/examples/keyvalue/kv/yarpc/keyvalueserver/server.go
--- /var/folders/b3/pnm730v50fg2ms_mtbrxkzwc0000gn/T/gofmt982401395 2016-10-24 12:44:16.000000000 -0700
+++ /var/folders/b3/pnm730v50fg2ms_mtbrxkzwc0000gn/T/gofmt041876534 2016-10-24 12:44:16.000000000 -0700
@@ -5,11 +5,11 @@

 import (
    "go.uber.org/fx/examples/keyvalue/kv/service/keyvalue"
-   "golang.org/x/net/context"
+   "go.uber.org/thriftrw/wire"
+   "go.uber.org/yarpc"
    "go.uber.org/yarpc/encoding/thrift"
    "go.uber.org/yarpc/transport"
-   "go.uber.org/yarpc"
-   "go.uber.org/thriftrw/wire"
+   "golang.org/x/net/context"
 )
abhinav commented 8 years ago

ThriftRW doesn't currently make much of an effort to generate linter friendly code. You should omit generated code from your linter.

See also https://github.com/thriftrw/thriftrw-go/issues/127

ascandella commented 8 years ago

Sure, we could mark this as low priority, but it's technically feasible to do this correctly, right?

abhinav commented 8 years ago

Yeah, it's technically feasible. It requires a little work in the code- templating system.

Note that the linter will still complain about missing docs until we start parsing the documentation for structs, etc. out of the Thrift file.

The YARPC-plugin-generated code is special in that it generates these default comments so your linter doesn't complain about that.

bufdev commented 7 years ago

Fixed by https://github.com/thriftrw/thriftrw-go/pull/311 and https://github.com/yarpc/yarpc-go/pull/1183.