Open
Description
Steps to reproduce:
- Setup dummy
main.go
package main
import (
"fmt"
machine "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
rest "k8s.io/client-go/rest"
)
func main() {
config := rest.Config{
Host: "(minikube ip):8443",
TLSClientConfig: rest.TLSClientConfig{
CAFile: "/path/to/ca.crt",
CertFile: "/path/to/client.crt",
KeyFile: "/path/to/client.key",
},
}
client, err := machine.NewForConfig(&config)
if err != nil {
panic(err)
}
machineList, err := client.Machine().List(metav1.ListOptions{})
if err != nil {
panic(err)
}
fmt.Println(len(machineList.Items))
}
- Try to run it and ensure it fails
$ go mod vendor && go mod tidy
$ go run -mod=vendor main.go
# github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:85:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:97:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:112:19: machine.Machine undefined (type *machine.Machine has no field or method Machine)
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:10:6: MachineInterface redeclared in this block
previous declaration at vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:21:6
vendor/github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:47:20: cannot use newMachines(c, namespace) (type *machines) as type MachineInterface in return argument:
*machines does not implement MachineInterface (missing AWSMachineClasses method)
Also golangci-lint reports for the same redeclaration of MachineInterface
.
$ golangci-lint run --version
golangci-lint has version 1.18.0 built from 31afdf8 on 2019-09-10T09:34:48Z
$ golangci-lint run ./...
pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go:10:6: `MachineInterface` redeclared in this block (typecheck)
type MachineInterface interface {
^
pkg/client/clientset/internalversion/typed/machine/internalversion/machine.go:21:6: other declaration of MachineInterface (typecheck)
type MachineInterface interface {
^
[...]
Activity