-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update golangci-lint to v1.50.1 (for go 1.18 compatibility) #3089
Conversation
The linter marked these as unused, as they're only used in tests; integration/api.go:45:20: func `(*dummyAPI).RemoveNode` is unused (unused) func (a *dummyAPI) RemoveNode(ctx context.Context, r *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error) { ^ integration/api.go:81:20: func `(*dummyAPI).CreateService` is unused (unused) func (a *dummyAPI) CreateService(ctx context.Context, r *api.CreateServiceRequest) (*api.CreateServiceResponse, error) { ^ integration/api.go:135:20: func `(*dummyAPI).UpdateCluster` is unused (unused) func (a *dummyAPI) UpdateCluster(ctx context.Context, r *api.UpdateClusterRequest) (*api.UpdateClusterResponse, error) { ^ integration/cluster.go:156:23: func `(*testCluster).runNode` is unused (unused) func (c *testCluster) runNode(n *testNode, nodeOrder int) error { ^ integration/node.go:56:6: func `newTestNode` is unused (unused) func newTestNode(joinAddr, joinToken string, lateBind bool, fips bool) (*testNode, error) { ^ integration/cluster.go:28:6: type `testCluster` is unused (unused) type testCluster struct { ^ integration/api.go:111:20: func `(*dummyAPI).RemoveNetwork` is unused (unused) func (a *dummyAPI) RemoveNetwork(context.Context, *api.RemoveNetworkRequest) (*api.RemoveNetworkResponse, error) { ^ integration/api.go:77:20: func `(*dummyAPI).ListServices` is unused (unused) func (a *dummyAPI) ListServices(context.Context, *api.ListServicesRequest) (*api.ListServicesResponse, error) { ^ integration/node.go:174:20: func `(*testNode).IsManager` is unused (unused) func (n *testNode) IsManager() bool { ^ integration/api.go:13:20: func `(*dummyAPI).GetNode` is unused (unused) func (a *dummyAPI) GetNode(ctx context.Context, r *api.GetNodeRequest) (*api.GetNodeResponse, error) { ^ integration/node.go:29:6: func `generateCerts` is unused (unused) func generateCerts(tmpDir string, rootCA *ca.RootCA, nodeID, role, org string, writeKey bool) error { ^ integration/api.go:115:20: func `(*dummyAPI).GetCluster` is unused (unused) func (a *dummyAPI) GetCluster(ctx context.Context, r *api.GetClusterRequest) (*api.GetClusterResponse, error) { ^ integration/node.go:113:20: func `(*testNode).stop` is unused (unused) func (n *testNode) stop() error { ^ integration/api.go:73:20: func `(*dummyAPI).GetService` is unused (unused) func (a *dummyAPI) GetService(context.Context, *api.GetServiceRequest) (*api.GetServiceResponse, error) { ^ integration/cluster.go:196:23: func `(*testCluster).CreateService` is unused (unused) func (c *testCluster) CreateService(name string, instances int) (string, error) { ^ integration/cluster.go:378:23: func `(*testCluster).RotateUnlockKey` is unused (unused) func (c *testCluster) RotateUnlockKey() error { ^ integration/cluster.go:397:23: func `(*testCluster).AutolockManagers` is unused (unused) func (c *testCluster) AutolockManagers(autolock bool) error { ^ integration/cluster.go:76:23: func `(*testCluster).AddManager` is unused (unused) func (c *testCluster) AddManager(lateBind bool, rootCA *ca.RootCA) error { ^ integration/api.go:55:20: func `(*dummyAPI).GetTask` is unused (unused) func (a *dummyAPI) GetTask(context.Context, *api.GetTaskRequest) (*api.GetTaskResponse, error) { ^ integration/cluster.go:278:23: func `(*testCluster).SetNodeRole` is unused (unused) func (c *testCluster) SetNodeRole(id string, role api.NodeRole) error { ^ integration/cluster.go:61:23: func `(*testCluster).RandomManager` is unused (unused) func (c *testCluster) RandomManager() *testNode { ^ integration/api.go:69:20: func `(*dummyAPI).RemoveTask` is unused (unused) func (a *dummyAPI) RemoveTask(context.Context, *api.RemoveTaskRequest) (*api.RemoveTaskResponse, error) { ^ integration/node.go:145:20: func `(*testNode).Stop` is unused (unused) func (n *testNode) Stop() error { ^ integration/cluster.go:348:23: func `(*testCluster).GetClusterInfo` is unused (unused) func (c *testCluster) GetClusterInfo() (*api.Cluster, error) { ^ integration/cluster.go:241:23: func `(*testCluster).RemoveNode` is unused (unused) func (c *testCluster) RemoveNode(id string, graceful bool) error { ^ integration/api.go:125:20: func `(*dummyAPI).ListClusters` is unused (unused) func (a *dummyAPI) ListClusters(ctx context.Context, r *api.ListClustersRequest) (*api.ListClustersResponse, error) { ^ integration/cluster.go:145:23: func `(*testCluster).AddNode` is unused (unused) func (c *testCluster) AddNode(n *testNode) error { ^ integration/node.go:22:6: type `testNode` is unused (unused) type testNode struct { ^ integration/cluster.go:359:23: func `(*testCluster).RotateRootCA` is unused (unused) func (c *testCluster) RotateRootCA(cert, key []byte) error { ^ integration/api.go:103:20: func `(*dummyAPI).ListNetworks` is unused (unused) func (a *dummyAPI) ListNetworks(context.Context, *api.ListNetworksRequest) (*api.ListNetworksResponse, error) { ^ integration/api.go:95:20: func `(*dummyAPI).RemoveService` is unused (unused) func (a *dummyAPI) RemoveService(context.Context, *api.RemoveServiceRequest) (*api.RemoveServiceResponse, error) { ^ integration/api.go:91:20: func `(*dummyAPI).UpdateService` is unused (unused) func (a *dummyAPI) UpdateService(context.Context, *api.UpdateServiceRequest) (*api.UpdateServiceResponse, error) { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
agent/reporter.go:18:13: `recieves` is a misspelling of `receives` (misspell) // Reporter recieves update to both task and volume status. ^ agent/reporter.go:30:6: type `volumeReporterFunc` is unused (unused) type volumeReporterFunc func(ctx context.Context, volumeID string) error ^ agent/reporter.go:32:30: func `volumeReporterFunc.ReportVolumeUnpublished` is unused (unused) func (fn volumeReporterFunc) ReportVolumeUnpublished(ctx context.Context, volumeID string) error { ^ agent/reporter.go:36:6: `statusReporterCombined` is unused (deadcode) type statusReporterCombined struct { ^ agent/session.go:394:19: func `(*session).sendTaskStatuses` is unused (unused) func (s *session) sendTaskStatuses(ctx context.Context, updates ...*api.UpdateTaskStatusRequest_TaskStatusUpdate) ([]*api.UpdateTaskStatusRequest_TaskStatusUpdate, error) { ^ agent/worker.go:60:2: field `publisher` is unused (unused) publisher exec.LogPublisher ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The CSI_CALL_TIMEOUT const looks to be only used internally, so un-exporting it. The PluginManager interface and NewPluginManager constructor have not yet been in a release, so renaming them. To be on the safe side, aliases were added. agent/csi/volumes.go:20:7: don't use ALL_CAPS in Go names; use CamelCase (golint) const CSI_CALL_TIMEOUT = 15 * time.Second ^ agent/csi/plugin/manager.go:23:6: exported: type name will be used as plugin.PluginManager by other packages, and that stutters; consider calling this Manager (revive) type PluginManager interface { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
agent/exec/dockerapi/container.go:79:27: func `(*containerConfig).endpoint` is unused (unused) func (c *containerConfig) endpoint() *api.Endpoint { ^ agent/exec/dockerapi/container.go:482:27: func `(*containerConfig).virtualIP` is unused (unused) func (c *containerConfig) virtualIP(networkID string) string { ^ agent/exec/controller_stub.go:24:2: field `cstatus` is unused (unused) cstatus *api.ContainerStatus ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Field is no longer used since 3252251 ca/server.go:68:2: field `rootReconciler` is unused (unused) rootReconciler *rootRotationReconciler ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
manager/allocator/network.go:378:21: func `(*Allocator).getAllocatedNetworks` is unused (unused) func (a *Allocator) getAllocatedNetworks() ([]*api.Network, error) { ^ manager/allocator/network.go:509:21: func `(*Allocator).deallocateNodes` is unused (unused) func (a *Allocator) deallocateNodes(ctx context.Context) error { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
manager/allocator/cnmallocator/portallocator.go:300:26: func `(*portAllocator).isPortsAllocated` is unused (unused) func (pa *portAllocator) isPortsAllocated(s *api.Service) bool { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
manager/scheduler/volumes.go:80:22: func `(*volumeSet).removeVolume` is unused (unused) func (vs *volumeSet) removeVolume(volumeID string) { ^ manager/scheduler/volumes.go:53:22: func `(*volumeSet).getVolume` is unused (unused) func (vs *volumeSet) getVolume(id string) *api.Volume { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
manager/state/raft/raft.go:1292:16: func `(*Node).reportNewAddress` is unused (unused) func (n *Node) reportNewAddress(ctx context.Context, id uint64) error { ^ manager/state/raft/raft.go:136:2: field `removeRaftCh` is unused (unused) removeRaftCh chan struct{} ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov Report
@@ Coverage Diff @@
## master #3089 +/- ##
=========================================
Coverage ? 62.15%
=========================================
Files ? 153
Lines ? 24177
Branches ? 0
=========================================
Hits ? 15028
Misses ? 7603
Partials ? 1546 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
//nolint:unused // TODO(thaJeztah) this is currently unused: is it safe to remove? | ||
func (c *containerConfig) virtualIP(networkID string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially removed things like these (as they are unused), but decided to keep that for a later discussion
@dperny @neersighted @corhere PTAL |
needed for #3070
Had to update configuration, and fix listing issues