Review by yuki.ito
Closed this issue · 5 comments
issue for reviewing code
試しに自分が作っているOSS: https://github.com/110y/bootes にて、下記のようなコマンドで ./...
を引数と渡して実行したところ
> impls types sigs.k8s.io/controller-runtime/pkg/reconcile.Reconciler ./...
次のような出力が得られました。
/path/to/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/reconcile/reconcile.go:96:6 reconcile.Func
/path/to/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/reconcile/reconcile.go:88:6 reconcile.Reconciler
/path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/cluster_reconciler.go:28:6 controller.ClusterReconciler
/path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/endpoint_reconciler.go:28:6 controller.EndpointReconciler
/path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/listener_reconciler.go:27:6 controller.ListenerReconciler
/path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/route_reconciler.go:27:6 controller.RouteReconciler
出力の1, 2行目は ./...
の対象内ではないように思いますが、意図通りの挙動でしょうか?
(コマンドを実行したディレクトリは /path/to/go/src/github.com/110y/bootes
です)
レビューありがとうございます!
試しに自分が作っているOSS: https://github.com/110y/bootes にて、下記のようなコマンドで
./...
を引数と渡して実行したところ> impls types sigs.k8s.io/controller-runtime/pkg/reconcile.Reconciler ./...
次のような出力が得られました。
/path/to/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/reconcile/reconcile.go:96:6 reconcile.Func /path/to/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.2/pkg/reconcile/reconcile.go:88:6 reconcile.Reconciler /path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/cluster_reconciler.go:28:6 controller.ClusterReconciler /path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/endpoint_reconciler.go:28:6 controller.EndpointReconciler /path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/listener_reconciler.go:27:6 controller.ListenerReconciler /path/to/go/src/github.com/110y/bootes/internal/k8s/internal/controller/route_reconciler.go:27:6 controller.RouteReconciler
出力の1, 2行目は
./...
の対象内ではないように思いますが、意図通りの挙動でしょうか?
(コマンドを実行したディレクトリは/path/to/go/src/github.com/110y/bootes
です)
これは一応把握していた挙動ですが、ツールに期待している挙動ではないです。
Reconcilerの型をとってくるために、packages.Loadに./...
だけではなくてsigs.k8s.io/controller-runtime/pkg/reconcile
も渡しています。
単純にsigs.k8s.io/controller-runtime/pkg/reconcile
を弾くと./...
にsigs.k8s.io/controller-runtime/pkg/reconcile
が含まれていたときにおかしくなるのでとりあえずこうなっていました。
修正方法はなんとなくわかっているので修正します。
レビューありがとうございます。
packages.Config の Tests を true にして、testファイルを探索の対象に入れても良いかなと思いました
test ファイルを含めるような flag (default = true) を作りたいと思います。