go.nvim
go.nvim copied to clipboard
`:GoPkgOutline` only shows fields of struct, not methods
When I run :GoPkgOutline with either of these two files open, I do not see any of the functions for the controller type.
https://github.com/kcp-dev/kcp/blob/main/pkg/reconciler/apis/apiexport/apiexport_reconcile.go https://github.com/kcp-dev/kcp/blob/main/pkg/reconciler/apis/apiexport/apiexport_controller.go
I only see fields defined directly on the controller struct, as seen in this screenshot.
When I run go doc -all -u -cmd github.com/kcp-dev/kcp/pkg/reconciler/apis/apiexport from the root of my checkout, I see all of the methods defined in both files.
kcp on main [$?] via 🐹 v1.18.5
✦ ❯ go doc -all -u -cmd github.com/kcp-dev/kcp/pkg/reconciler/apis/apiexport
...
type controller struct {
// all content here is shown as expected
}
...
func (c *controller) enqueueSecret(obj interface{})
func (c *controller) ensureSecretNamespaceExists(ctx context.Context, clusterName logicalcluster.Name)
func (c *controller) process(ctx context.Context, key string) error
func (c *controller) processNextWorkItem(ctx context.Context) bool
func (c *controller) readThroughGetSecret(ctx context.Context, clusterName logicalcluster.Name, ns, name string) (*corev1.Secret, error)
...
If it's helpful, here's my nvim configuration (sorry, I know it's messy).
Do I have something misconfigured?
I got slightly different output:
go: bitbucket.org/bertimus9/[email protected]: invalid version: git ls-remote -q origin in /home/ray/go/pkg/mod/cache/vcs/18196d4b851acdc82074f1167e08ff0546099c3c93cfcb8a105b9956a1c0541f: exit status 128:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
go: k8s.io/[email protected] requires
bitbucket.org/bertimus9/[email protected]: invalid version: git ls-remote -q origin in /home/ray/go/pkg/mod/cache/vcs/18196d4b851acdc82074f1167e08ff0546099c3c93cfcb8a105b9956a1c0541f: exit status 128:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
package apiexport // import "github.com/kcp-dev/kcp/pkg/reconciler/apis/apiexport"
CONSTANTS
const (
ControllerName = "kcp-apiexport"
DefaultIdentitySecretNamespace = "kcp-system"
)
FUNCTIONS
func GenerateIdentitySecret(ctx context.Context, ns string, apiExportName string) (*corev1.Secret, error)
func IdentityHash(secret *corev1.Secret) (string, error)
TYPES
type APIExport = apisv1alpha1.APIExport
type APIExportSpec = apisv1alpha1.APIExportSpec
type APIExportStatus = apisv1alpha1.APIExportStatus
type CommitFunc = func(context.Context, *Resource, *Resource) error
type Patcher = apisv1alpha1client.APIExportInterface
type Resource = committer.Resource[*APIExportSpec, *APIExportStatus]
type controller struct {
queue workqueue.RateLimitingInterface
kcpClusterClient kcpclientset.ClusterInterface
kubeClusterClient kcpkubernetesclientset.ClusterInterface
listAPIExports func() ([]*apisv1alpha1.APIExport, error)
listAPIExportsForSecret func(secret *corev1.Secret) ([]*apisv1alpha1.APIExport, error)
getAPIExport func(clusterName logicalcluster.Name, name string) (*apisv1alpha1.APIExport, error)
getNamespace func(clusterName logicalcluster.Name, name string) (*corev1.Namespace, error)
createNamespace func(ctx context.Context, clusterName logicalcluster.Path, ns *corev1.Namespace) error
secretNamespace string
getSecret func(ctx context.Context, clusterName logicalcluster.Name, ns, name string) (*corev1.Secret, error)
createSecret func(ctx context.Context, clusterName logicalcluster.Path, secret *corev1.Secret) error
listShards func() ([]*corev1alpha1.Shard, error)
commit CommitFunc
}
controller reconciles APIExports. It ensures an export's identity secret
exists and is valid.
func NewController(
kcpClusterClient kcpclientset.ClusterInterface,
apiExportInformer apisv1alpha1informers.APIExportClusterInformer,
shardInformer corev1alpha1informers.ShardClusterInformer,
kubeClusterClient kcpkubernetesclientset.ClusterInterface,
namespaceInformer kcpcorev1informers.NamespaceClusterInformer,
secretInformer kcpcorev1informers.SecretClusterInformer,
) (*controller, error)
NewController returns a new controller for APIExports.
func (c *controller) Start(ctx context.Context, numThreads int)
Start starts the controller, which stops when ctx.Done() is closed.
func (c *controller) createIdentitySecret(ctx context.Context, clusterName logicalcluster.Path, apiExportName string) error
func (c *controller) enqueueAPIExport(apiExport *apisv1alpha1.APIExport)
enqueueAPIExport enqueues an APIExport.
func (c *controller) enqueueAllAPIExports(shard *corev1alpha1.Shard)
func (c *controller) enqueueSecret(secret *corev1.Secret)
func (c *controller) ensureSecretNamespaceExists(ctx context.Context, clusterName logicalcluster.Name)
func (c *controller) process(ctx context.Context, key string) error
func (c *controller) processNextWorkItem(ctx context.Context) bool
func (c *controller) reconcile(ctx context.Context, apiExport *apisv1alpha1.APIExport) error
func (c *controller) startWorker(ctx context.Context)
func (c *controller) updateOrVerifyIdentitySecretHash(ctx context.Context, clusterName logicalcluster.Name, apiExport *apisv1alpha1.APIExport) error
func (c *controller) updateVirtualWorkspaceURLs(ctx context.Context, apiExport *apisv1alpha1.APIExport) error
Which means treesitter can not parse the above out.
Also the command took an extremely long time to finish in my system. Might be because of the git issue. I do not see a way I can fix. (the command took too long and incorrect output a parser failed to understand)
I'm not sure if it's related to this, but I had been consistentely getting incomplete package outlines when running something like GoPkgOutline -p io. I looked more closely and I needed to add stdout_buffered = true to the go doc job. It was calling on_stdout several times and on the last call only part of the full output was being handled.
I also noticed that package level documentation (before the named sections) shows up as single word constants/variables