You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//go:generate go run go.uber.org/mock/mockgen -source $GOFILE -package=fake -destination=fake/zz_generated_mock_$GOFILE -imports restclient=k8s.io/client-go/rest
It returns the same error.
When I copy the functions from the interface I would like to implement , the mock generation works . So the following content generate the mock file without errors.
//go:generate go run go.uber.org/mock/mockgen -source $GOFILE -package=fake -destination=fake/zz_generated_mock_$GOFILE
package kubernetes
import (
"context"
v1 "k8s.io/api/core/v1"
policyv1 "k8s.io/api/policy/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
restclient "k8s.io/client-go/rest"
)
type PodPodExpansion interface {
Bind(ctx context.Context, binding *v1.Binding, opts metav1.CreateOptions) error
// Evict submits a policy/v1beta1 Eviction request to the pod's eviction subresource.
// Equivalent to calling EvictV1beta1.
// Deprecated: Use EvictV1() (supported in 1.22+) or EvictV1beta1().
Evict(ctx context.Context, eviction *policyv1beta1.Eviction) error
// EvictV1 submits a policy/v1 Eviction request to the pod's eviction subresource.
// Supported in 1.22+.
EvictV1(ctx context.Context, eviction *policyv1.Eviction) error
// EvictV1beta1 submits a policy/v1beta1 Eviction request to the pod's eviction subresource.
// Supported in 1.22+.
EvictV1beta1(ctx context.Context, eviction *policyv1beta1.Eviction) error
GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request
ProxyGet(scheme, name, port, path string, params map[string]string) restclient.ResponseWrapper
}
When I change the import from restclient "k8s.io/client-go/rest" to rest "k8s.io/client-go/rest" , in the original files that generate the error, it also works.
I suspect that the import alias name restclient have some issues to be parsed by the mockgen.
Triage Notes for the Maintainers
The text was updated successfully, but these errors were encountered:
Actual behavior
I get a unknow package error during a mock generation due to an import with an a alias name. The error message is :
Expected behavior
The mock generation works without errors.
To Reproduce
For information, This is the useful part of the content of the
PodExpansion
for the current bug :Additional Information
It returns the same error.
restclient "k8s.io/client-go/rest"
torest "k8s.io/client-go/rest"
, in the original files that generate the error, it also works.I suspect that the import alias name
restclient
have some issues to be parsed by the mockgen.Triage Notes for the Maintainers
The text was updated successfully, but these errors were encountered: