Skip to content

Resolve govet copylocks lint errors #811

@austinvazquez

Description

@austinvazquez

The following lint errors should be resolved:

Error: runtime/service.go:1032:10: copylocks: range var ni copies lock: github.com/firecracker-microvm/firecracker-containerd/proto.FirecrackerNetworkInterface contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
		for _, ni := range s.config.DefaultNetworkInterfaces {

Error: runtime/service.go:1033:14: copylocks: assignment copies lock value to niCopy: github.com/firecracker-microvm/firecracker-containerd/proto.FirecrackerNetworkInterface contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			niCopy := ni // we don't want to allow any further calls to modify structs in s.config.DefaultNetworkInterfaces
			          ^
Error: runtime/benchmark_test.go:35:10: copylocks: createAndStopVM passes lock by value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
	request proto.CreateVMRequest,
	        ^
Error: runtime/benchmark_test.go:81:50: copylocks: call of createAndStopVM copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
		elapsed, err := createAndStopVM(ctx, fcClient, request)
		                                               ^
Error: runtime/service_integ_test.go:763:9: copylocks: range var subtest copies lock: struct{name string; request github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest} contains github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
	for _, subtest := range subtests {
	       ^
Error: runtime/service_integ_test.go:764:14: copylocks: assignment copies lock value to request: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
		request := subtest.request
		           ^
Error: runtime/service_integ_test.go:1698:98: copylocks: func passes lock by value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			stopFunc: func(ctx context.Context, tb testing.TB, fcClient fccontrol.FirecrackerService, req proto.CreateVMRequest) {
			                                                                                              ^
Error: runtime/service_integ_test.go:1716:98: copylocks: func passes lock by value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			stopFunc: func(ctx context.Context, tb testing.TB, fcClient fccontrol.FirecrackerService, req proto.CreateVMRequest) {
			                                                                                              ^
Error: runtime/service_integ_test.go:1730:89: copylocks: func passes lock by value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			stopFunc: func(ctx context.Context, tb testing.TB, _ fccontrol.FirecrackerService, _ proto.CreateVMRequest) {
			                                                                                     ^
Error: runtime/service_integ_test.go:1820:9: copylocks: range var test copies lock: struct{name string; createVMRequest github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest; stopFunc func(ctx context.Context, tb testing.TB, fcClient github.com/firecracker-microvm/firecracker-containerd/proto/service/fccontrol/ttrpc.FirecrackerService, req github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest); withStopVM bool} contains github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
	for _, test := range tests {
	       ^
Error: runtime/service_integ_test.go:1851:37: copylocks: call of test.stopFunc copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			test.stopFunc(ctx, tb, fcClient, createVMRequest)
			                                 ^
Error: runtime/service_integ_test.go:1870:11: copylocks: assignment copies lock value to req: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			req := test.createVMRequest
			       ^
Error: runtime/service_integ_test.go:1872:16: copylocks: call of testFunc copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			testFunc(t, req)
			            ^
Error: runtime/service_integ_test.go:1876:11: copylocks: assignment copies lock value to req: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			req := test.createVMRequest
			       ^
Error: runtime/service_integ_test.go:1882:16: copylocks: call of testFunc copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			testFunc(t, req)
Error: runtime/service_integ_test.go:2350:9: copylocks: range var s copies lock: github.com/firecracker-microvm/firecracker-containerd/runtime.subtest contains github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
	for _, s := range subtests {
	       ^
Error: runtime/service_integ_test.go:2351:14: copylocks: assignment copies lock value to request: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
		request := s.request
		           ^
Error: runtime/service_integ_test.go:2353:15: copylocks: call of runTest copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			runTest(t, request, s)
			           ^
Error: runtime/service_integ_test.go:2356:24: copylocks: assignment copies lock value to requestWithJailer: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
		requestWithJailer := s.request
		                     ^
Error: runtime/service_integ_test.go:2362:15: copylocks: call of runTest copies lock value: github.com/firecracker-microvm/firecracker-containerd/proto.CreateVMRequest contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet)
			runTest(t, requestWithJailer, s)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions