Skip to content

Commit c97052e

Browse files
committedApr 20, 2023
fix new revive lint errors
1 parent eb6f39e commit c97052e

File tree

29 files changed

+84
-83
lines changed

29 files changed

+84
-83
lines changed
 

‎auth/simple/credential.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func NewBasicCredential(username, password string) *BasicCredential {
1414
}
1515

1616
// GetRequestMetadata for basic auth
17-
func (c BasicCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
17+
func (c BasicCredential) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error) {
1818
return map[string]string{
1919
c.username: c.password,
2020
}, nil

‎auth/simple/simple.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewBasicAuth(username, password string) *BasicAuth {
2121
}
2222

2323
// StreamInterceptor define stream interceptor
24-
func (b *BasicAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
24+
func (b *BasicAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
2525
ctx := stream.Context()
2626
if err := b.doAuth(ctx); err != nil {
2727
return err
@@ -30,7 +30,7 @@ func (b *BasicAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream,
3030
}
3131

3232
// UnaryInterceptor define unary interceptor
33-
func (b *BasicAuth) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
33+
func (b *BasicAuth) UnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
3434
if err := b.doAuth(ctx); err != nil {
3535
return nil, err
3636
}

‎client/resolver/eru/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ func (b *eruResolverBuilder) Scheme() string {
1616
}
1717

1818
// Build for interface
19-
func (b *eruResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
19+
func (b *eruResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
2020
return New(cc, target.URL.Path, target.URL.Host), nil
2121
}

‎client/resolver/static/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ func (b *staticResolverBuilder) Scheme() string {
1414
}
1515

1616
// Build for interface
17-
func (b *staticResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
17+
func (b *staticResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
1818
return New(cc, target.URL.Path), nil
1919
}

‎client/servicediscovery/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ func (b *LBResolverBuilder) Scheme() string {
2222
}
2323

2424
// Build for interface
25-
func (b *LBResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
25+
func (b *LBResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
2626
return newLBResolver(cc, target.URL.Path, b.updateCh), nil
2727
}

‎cluster/calcium/wal.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (h *CreateWorkloadHandler) Typ() string {
133133
}
134134

135135
// Check .
136-
func (h *CreateWorkloadHandler) Check(ctx context.Context, raw interface{}) (handle bool, err error) {
136+
func (h *CreateWorkloadHandler) Check(_ context.Context, raw interface{}) (handle bool, err error) {
137137
_, ok := raw.(*types.Workload)
138138
if !ok {
139139
return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw)
@@ -210,7 +210,7 @@ func (h *WorkloadResourceAllocatedHandler) Typ() string {
210210
}
211211

212212
// Check .
213-
func (h *WorkloadResourceAllocatedHandler) Check(ctx context.Context, raw interface{}) (bool, error) {
213+
func (h *WorkloadResourceAllocatedHandler) Check(_ context.Context, raw interface{}) (bool, error) {
214214
if _, ok := raw.([]*types.Node); !ok {
215215
return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw)
216216
}
@@ -281,7 +281,7 @@ func (h *ProcessingCreatedHandler) Typ() string {
281281
}
282282

283283
// Check .
284-
func (h ProcessingCreatedHandler) Check(ctx context.Context, raw interface{}) (bool, error) {
284+
func (h ProcessingCreatedHandler) Check(_ context.Context, raw interface{}) (bool, error) {
285285
if _, ok := raw.(*types.Processing); !ok {
286286
return false, errors.Wrapf(types.ErrInvalidWALDataType, "%+v", raw)
287287
}

‎engine/docker/build.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ USER {{.User}}
4343
)
4444

4545
// BuildRefs output refs
46-
func (e *Engine) BuildRefs(ctx context.Context, opts *enginetypes.BuildRefOptions) []string {
46+
func (e *Engine) BuildRefs(_ context.Context, opts *enginetypes.BuildRefOptions) []string {
4747
name := opts.Name
4848
tags := opts.Tags
4949
refs := []string{}

‎engine/docker/container.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (e *Engine) VirtualizationResize(ctx context.Context, workloadID string, he
398398
}
399399

400400
// VirtualizationWait wait virtualization exit
401-
func (e *Engine) VirtualizationWait(ctx context.Context, ID, state string) (*enginetypes.VirtualizationWaitResult, error) {
401+
func (e *Engine) VirtualizationWait(ctx context.Context, ID, _ string) (*enginetypes.VirtualizationWaitResult, error) {
402402
waitBody, errorCh := e.client.ContainerWait(ctx, ID, dockercontainer.WaitConditionNotRunning)
403403
r := &enginetypes.VirtualizationWaitResult{}
404404
select {

‎engine/docker/exec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (e *Engine) demultiplexStdStream(ctx context.Context, stdStream io.Reader)
7878
}
7979

8080
// ExecExitCode get exec return code
81-
func (e *Engine) ExecExitCode(ctx context.Context, ID, execID string) (int, error) {
81+
func (e *Engine) ExecExitCode(ctx context.Context, _, execID string) (int, error) {
8282
r, err := e.client.ContainerExecInspect(ctx, execID)
8383
if err != nil {
8484
return -1, err

‎engine/docker/network.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
// NetworkConnect connect to a network
17-
func (e *Engine) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) ([]string, error) {
17+
func (e *Engine) NetworkConnect(ctx context.Context, network, target, ipv4, _ string) ([]string, error) {
1818
config, err := e.makeIPV4EndpointSetting(ipv4)
1919
if err != nil {
2020
return nil, err

‎engine/fake/fake.go

+32-32
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ type EngineWithErr struct {
1616
}
1717

1818
// Info .
19-
func (f *EngineWithErr) Info(ctx context.Context) (*enginetypes.Info, error) {
19+
func (f *EngineWithErr) Info(_ context.Context) (*enginetypes.Info, error) {
2020
return nil, f.DefaultErr
2121
}
2222

2323
// Ping .
24-
func (f *EngineWithErr) Ping(ctx context.Context) error {
24+
func (f *EngineWithErr) Ping(_ context.Context) error {
2525
return f.DefaultErr
2626
}
2727

@@ -31,151 +31,151 @@ func (f *EngineWithErr) CloseConn() error {
3131
}
3232

3333
// Execute .
34-
func (f *EngineWithErr) Execute(ctx context.Context, ID string, config *enginetypes.ExecConfig) (execID string, stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
34+
func (f *EngineWithErr) Execute(context.Context, string, *enginetypes.ExecConfig) (execID string, stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
3535
return "", nil, nil, nil, f.DefaultErr
3636
}
3737

3838
// ExecResize .
39-
func (f *EngineWithErr) ExecResize(ctx context.Context, execID string, height, width uint) (err error) {
39+
func (f *EngineWithErr) ExecResize(context.Context, string, uint, uint) (err error) {
4040
return f.DefaultErr
4141
}
4242

4343
// ExecExitCode .
44-
func (f *EngineWithErr) ExecExitCode(ctx context.Context, ID, result string) (int, error) {
44+
func (f *EngineWithErr) ExecExitCode(context.Context, string, string) (int, error) {
4545
return 0, f.DefaultErr
4646
}
4747

4848
// NetworkConnect .
49-
func (f *EngineWithErr) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) ([]string, error) {
49+
func (f *EngineWithErr) NetworkConnect(context.Context, string, string, string, string) ([]string, error) {
5050
return nil, f.DefaultErr
5151
}
5252

5353
// NetworkDisconnect .
54-
func (f *EngineWithErr) NetworkDisconnect(ctx context.Context, network, target string, force bool) error {
54+
func (f *EngineWithErr) NetworkDisconnect(context.Context, string, string, bool) error {
5555
return f.DefaultErr
5656
}
5757

5858
// NetworkList .
59-
func (f *EngineWithErr) NetworkList(ctx context.Context, drivers []string) ([]*enginetypes.Network, error) {
59+
func (f *EngineWithErr) NetworkList(context.Context, []string) ([]*enginetypes.Network, error) {
6060
return nil, f.DefaultErr
6161
}
6262

6363
// ImageList .
64-
func (f *EngineWithErr) ImageList(ctx context.Context, image string) ([]*enginetypes.Image, error) {
64+
func (f *EngineWithErr) ImageList(context.Context, string) ([]*enginetypes.Image, error) {
6565
return nil, f.DefaultErr
6666
}
6767

6868
// ImageRemove .
69-
func (f *EngineWithErr) ImageRemove(ctx context.Context, image string, force, prune bool) ([]string, error) {
69+
func (f *EngineWithErr) ImageRemove(context.Context, string, bool, bool) ([]string, error) {
7070
return nil, f.DefaultErr
7171
}
7272

7373
// ImagesPrune .
74-
func (f *EngineWithErr) ImagesPrune(ctx context.Context) error {
74+
func (f *EngineWithErr) ImagesPrune(context.Context) error {
7575
return f.DefaultErr
7676
}
7777

7878
// ImagePull .
79-
func (f *EngineWithErr) ImagePull(ctx context.Context, ref string, all bool) (io.ReadCloser, error) {
79+
func (f *EngineWithErr) ImagePull(context.Context, string, bool) (io.ReadCloser, error) {
8080
return nil, f.DefaultErr
8181
}
8282

8383
// ImagePush .
84-
func (f *EngineWithErr) ImagePush(ctx context.Context, ref string) (io.ReadCloser, error) {
84+
func (f *EngineWithErr) ImagePush(context.Context, string) (io.ReadCloser, error) {
8585
return nil, f.DefaultErr
8686
}
8787

8888
// ImageBuild .
89-
func (f *EngineWithErr) ImageBuild(ctx context.Context, input io.Reader, refs []string, _ string) (io.ReadCloser, error) {
89+
func (f *EngineWithErr) ImageBuild(context.Context, io.Reader, []string, string) (io.ReadCloser, error) {
9090
return nil, f.DefaultErr
9191
}
9292

9393
// ImageBuildCachePrune .
94-
func (f *EngineWithErr) ImageBuildCachePrune(ctx context.Context, all bool) (uint64, error) {
94+
func (f *EngineWithErr) ImageBuildCachePrune(context.Context, bool) (uint64, error) {
9595
return 0, f.DefaultErr
9696
}
9797

9898
// ImageLocalDigests .
99-
func (f *EngineWithErr) ImageLocalDigests(ctx context.Context, image string) ([]string, error) {
99+
func (f *EngineWithErr) ImageLocalDigests(context.Context, string) ([]string, error) {
100100
return nil, f.DefaultErr
101101
}
102102

103103
// ImageRemoteDigest .
104-
func (f *EngineWithErr) ImageRemoteDigest(ctx context.Context, image string) (string, error) {
104+
func (f *EngineWithErr) ImageRemoteDigest(context.Context, string) (string, error) {
105105
return "", f.DefaultErr
106106
}
107107

108108
// ImageBuildFromExist .
109-
func (f *EngineWithErr) ImageBuildFromExist(ctx context.Context, ID string, refs []string, user string) (string, error) {
109+
func (f *EngineWithErr) ImageBuildFromExist(context.Context, string, []string, string) (string, error) {
110110
return "", f.DefaultErr
111111
}
112112

113113
// BuildRefs .
114-
func (f *EngineWithErr) BuildRefs(ctx context.Context, opts *enginetypes.BuildRefOptions) []string {
114+
func (f *EngineWithErr) BuildRefs(context.Context, *enginetypes.BuildRefOptions) []string {
115115
return nil
116116
}
117117

118118
// BuildContent .
119-
func (f *EngineWithErr) BuildContent(ctx context.Context, scm coresource.Source, opts *enginetypes.BuildContentOptions) (string, io.Reader, error) {
119+
func (f *EngineWithErr) BuildContent(context.Context, coresource.Source, *enginetypes.BuildContentOptions) (string, io.Reader, error) {
120120
return "", nil, f.DefaultErr
121121
}
122122

123123
// VirtualizationCreate .
124-
func (f *EngineWithErr) VirtualizationCreate(ctx context.Context, opts *enginetypes.VirtualizationCreateOptions) (*enginetypes.VirtualizationCreated, error) {
124+
func (f *EngineWithErr) VirtualizationCreate(context.Context, *enginetypes.VirtualizationCreateOptions) (*enginetypes.VirtualizationCreated, error) {
125125
return nil, f.DefaultErr
126126
}
127127

128128
// VirtualizationCopyTo .
129-
func (f *EngineWithErr) VirtualizationCopyTo(ctx context.Context, ID, target string, content []byte, uid, gid int, mode int64) error {
129+
func (f *EngineWithErr) VirtualizationCopyTo(context.Context, string, string, []byte, int, int, int64) error {
130130
return f.DefaultErr
131131
}
132132

133133
// VirtualizationStart .
134-
func (f *EngineWithErr) VirtualizationStart(ctx context.Context, ID string) error {
134+
func (f *EngineWithErr) VirtualizationStart(context.Context, string) error {
135135
return f.DefaultErr
136136
}
137137

138138
// VirtualizationStop .
139-
func (f *EngineWithErr) VirtualizationStop(ctx context.Context, ID string, gracefulTimeout time.Duration) error {
139+
func (f *EngineWithErr) VirtualizationStop(context.Context, string, time.Duration) error {
140140
return f.DefaultErr
141141
}
142142

143143
// VirtualizationRemove .
144-
func (f *EngineWithErr) VirtualizationRemove(ctx context.Context, ID string, volumes, force bool) error {
144+
func (f *EngineWithErr) VirtualizationRemove(context.Context, string, bool, bool) error {
145145
return f.DefaultErr
146146
}
147147

148148
// VirtualizationInspect .
149-
func (f *EngineWithErr) VirtualizationInspect(ctx context.Context, ID string) (*enginetypes.VirtualizationInfo, error) {
149+
func (f *EngineWithErr) VirtualizationInspect(context.Context, string) (*enginetypes.VirtualizationInfo, error) {
150150
return nil, f.DefaultErr
151151
}
152152

153153
// VirtualizationLogs .
154-
func (f *EngineWithErr) VirtualizationLogs(ctx context.Context, opts *enginetypes.VirtualizationLogStreamOptions) (stdout, stderr io.ReadCloser, err error) {
154+
func (f *EngineWithErr) VirtualizationLogs(context.Context, *enginetypes.VirtualizationLogStreamOptions) (stdout, stderr io.ReadCloser, err error) {
155155
return nil, nil, f.DefaultErr
156156
}
157157

158158
// VirtualizationAttach .
159-
func (f *EngineWithErr) VirtualizationAttach(ctx context.Context, ID string, stream, openStdin bool) (stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
159+
func (f *EngineWithErr) VirtualizationAttach(context.Context, string, bool, bool) (stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
160160
return nil, nil, nil, f.DefaultErr
161161
}
162162

163163
// VirtualizationResize .
164-
func (f *EngineWithErr) VirtualizationResize(ctx context.Context, ID string, height, width uint) error {
164+
func (f *EngineWithErr) VirtualizationResize(context.Context, string, uint, uint) error {
165165
return f.DefaultErr
166166
}
167167

168168
// VirtualizationWait .
169-
func (f *EngineWithErr) VirtualizationWait(ctx context.Context, ID, state string) (*enginetypes.VirtualizationWaitResult, error) {
169+
func (f *EngineWithErr) VirtualizationWait(context.Context, string, string) (*enginetypes.VirtualizationWaitResult, error) {
170170
return nil, f.DefaultErr
171171
}
172172

173173
// VirtualizationUpdateResource .
174-
func (f *EngineWithErr) VirtualizationUpdateResource(ctx context.Context, ID string, engineParams resourcetypes.Resources) error {
174+
func (f *EngineWithErr) VirtualizationUpdateResource(context.Context, string, resourcetypes.Resources) error {
175175
return f.DefaultErr
176176
}
177177

178178
// VirtualizationCopyFrom .
179-
func (f *EngineWithErr) VirtualizationCopyFrom(ctx context.Context, ID, path string) (content []byte, uid, gid int, mode int64, _ error) {
179+
func (f *EngineWithErr) VirtualizationCopyFrom(context.Context, string, string) (content []byte, uid, gid int, mode int64, _ error) {
180180
return nil, 0, 0, 0, f.DefaultErr
181181
}

‎engine/mocks/fakeengine/mock.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (wc *writeCloser) Close() error {
3636
}
3737

3838
// MakeClient make a mock client
39-
func MakeClient(ctx context.Context, config coretypes.Config, nodename, endpoint, ca, cert, key string) (engine.API, error) {
39+
func MakeClient(_ context.Context, _ coretypes.Config, _, _, _, _, _ string) (engine.API, error) {
4040
e := &enginemocks.API{}
4141
// info
4242
e.On("Info", mock.Anything).Return(&enginetypes.Info{NCPU: 100, MemTotal: units.GiB * 100, StorageTotal: units.GiB * 100}, nil)

‎engine/systemd/exec.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import (
99
)
1010

1111
// Execute executes a cmd and attaches stdio
12-
func (e *Engine) Execute(ctx context.Context, target string, config *enginetypes.ExecConfig) (execID string, stdout io.ReadCloser, stderr io.ReadCloser, writer io.WriteCloser, err error) {
12+
func (e *Engine) Execute(_ context.Context, _ string, _ *enginetypes.ExecConfig) (execID string, stdout io.ReadCloser, stderr io.ReadCloser, writer io.WriteCloser, err error) {
1313
err = types.ErrEngineNotImplemented
1414
return
1515
}
1616

1717
// ExecResize resize the terminal size
18-
func (e *Engine) ExecResize(ctx context.Context, execID string, height, width uint) (err error) {
18+
func (e *Engine) ExecResize(_ context.Context, _ string, _, _ uint) (err error) {
1919
err = types.ErrEngineNotImplemented
2020
return
2121
}
2222

2323
// ExecExitCode fetches exceuction exit code
24-
func (e *Engine) ExecExitCode(ctx context.Context, ID, execID string) (execCode int, err error) {
24+
func (e *Engine) ExecExitCode(_ context.Context, _, _ string) (execCode int, err error) {
2525
err = types.ErrEngineNotImplemented
2626
return
2727
}

‎engine/systemd/image.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
)
1111

1212
// BuildRefs builds images refs
13-
func (e *Engine) BuildRefs(ctx context.Context, opts *enginetypes.BuildRefOptions) (refs []string) {
13+
func (e *Engine) BuildRefs(context.Context, *enginetypes.BuildRefOptions) (refs []string) {
1414
return
1515
}
1616

1717
// BuildContent builds image content
18-
func (e *Engine) BuildContent(ctx context.Context, scm coresource.Source, opts *enginetypes.BuildContentOptions) (dir string, reader io.Reader, err error) {
18+
func (e *Engine) BuildContent(context.Context, coresource.Source, *enginetypes.BuildContentOptions) (dir string, reader io.Reader, err error) {
1919
err = types.ErrEngineNotImplemented
2020
return
2121
}

‎engine/systemd/network.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import (
88
)
99

1010
// NetworkConnect connects target netloc
11-
func (e *Engine) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) (subnets []string, err error) {
11+
func (e *Engine) NetworkConnect(_ context.Context, _, _, _, _ string) (subnets []string, err error) {
1212
err = types.ErrEngineNotImplemented
1313
return
1414
}
1515

1616
// NetworkDisconnect disconnects target netloc
17-
func (e *Engine) NetworkDisconnect(ctx context.Context, network, target string, force bool) (err error) {
17+
func (e *Engine) NetworkDisconnect(_ context.Context, _, _ string, _ bool) (err error) {
1818
err = types.ErrEngineNotImplemented
1919
return
2020
}
2121

2222
// NetworkList lists networks
23-
func (e *Engine) NetworkList(ctx context.Context, driver []string) (networks []*enginetypes.Network, err error) {
23+
func (e *Engine) NetworkList(_ context.Context, _ []string) (networks []*enginetypes.Network, err error) {
2424
err = types.ErrEngineNotImplemented
2525
return
2626
}

‎engine/systemd/virtualization.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ import (
1010
)
1111

1212
// VirtualizationLogs fetches service logs
13-
func (e *Engine) VirtualizationLogs(ctx context.Context, opts *enginetypes.VirtualizationLogStreamOptions) (stdout io.ReadCloser, stderr io.ReadCloser, err error) {
13+
func (e *Engine) VirtualizationLogs(_ context.Context, _ *enginetypes.VirtualizationLogStreamOptions) (stdout io.ReadCloser, stderr io.ReadCloser, err error) {
1414
err = types.ErrEngineNotImplemented
1515
return
1616
}
1717

1818
// VirtualizationAttach attaches a service's stdio
19-
func (e *Engine) VirtualizationAttach(ctx context.Context, ID string, stream, stdin bool) (stdout, stderr io.ReadCloser, writer io.WriteCloser, err error) {
19+
func (e *Engine) VirtualizationAttach(_ context.Context, _ string, _, _ bool) (stdout, stderr io.ReadCloser, writer io.WriteCloser, err error) {
2020
err = types.ErrEngineNotImplemented
2121
return
2222
}
2323

2424
// VirtualizationResize resizes a terminal window
25-
func (e *Engine) VirtualizationResize(ctx context.Context, ID string, height, width uint) (err error) {
25+
func (e *Engine) VirtualizationResize(_ context.Context, _ string, _, _ uint) (err error) {
2626
err = types.ErrEngineNotImplemented
2727
return
2828
}
2929

3030
// VirtualizationWait waits for service finishing
31-
func (e *Engine) VirtualizationWait(ctx context.Context, ID, state string) (res *enginetypes.VirtualizationWaitResult, err error) {
31+
func (e *Engine) VirtualizationWait(_ context.Context, _, _ string) (res *enginetypes.VirtualizationWaitResult, err error) {
3232
err = types.ErrEngineNotImplemented
3333
return
3434
}
3535

3636
// VirtualizationUpdateResource updates service resource limits
37-
func (e *Engine) VirtualizationUpdateResource(ctx context.Context, ID string, params resourcetypes.Resources) (err error) {
37+
func (e *Engine) VirtualizationUpdateResource(context.Context, string, resourcetypes.Resources) (err error) {
3838
err = types.ErrEngineNotImplemented
3939
return
4040
}

‎engine/virt/image.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (v *Virt) ImagePush(ctx context.Context, ref string) (rc io.ReadCloser, err
9191
}
9292

9393
// ImageBuild captures from a guest.
94-
func (v *Virt) ImageBuild(ctx context.Context, input io.Reader, refs []string, _ string) (rc io.ReadCloser, err error) {
94+
func (v *Virt) ImageBuild(ctx context.Context, _ io.Reader, _ []string, _ string) (rc io.ReadCloser, err error) {
9595
log.WithFunc("engine.virt.ImageBuild").Warnf(ctx, "imageBuild does not implement")
9696
return
9797
}
@@ -122,7 +122,7 @@ func (v *Virt) ImageBuildFromExist(ctx context.Context, ID string, refs []string
122122
}
123123

124124
// ImageBuildCachePrune prunes cached one.
125-
func (v *Virt) ImageBuildCachePrune(ctx context.Context, all bool) (reclaimed uint64, err error) {
125+
func (v *Virt) ImageBuildCachePrune(ctx context.Context, _ bool) (reclaimed uint64, err error) {
126126
log.WithFunc("engine.virt.ImageBuildCachePrune").Warnf(ctx, "ImageBuildCachePrune does not implement and not required by vm")
127127
return
128128
}

‎engine/virt/virt.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type Virt struct {
4343
}
4444

4545
// MakeClient makes a virt. client which wraps yavirt API client.
46-
func MakeClient(ctx context.Context, config coretypes.Config, nodename, endpoint, ca, cert, key string) (engine.API, error) {
46+
func MakeClient(_ context.Context, config coretypes.Config, _, endpoint, _, _, _ string) (engine.API, error) {
4747
var uri string
4848
switch {
4949
case strings.HasPrefix(endpoint, HTTPPrefixKey):
@@ -126,7 +126,7 @@ func (v *Virt) ExecResize(ctx context.Context, execID string, height, width uint
126126
}
127127

128128
// NetworkConnect connects to a network.
129-
func (v *Virt) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 string) (cidrs []string, err error) {
129+
func (v *Virt) NetworkConnect(ctx context.Context, network, target, ipv4, _ string) (cidrs []string, err error) {
130130
req := virttypes.ConnectNetworkReq{
131131
Network: network,
132132
IPv4: ipv4,
@@ -144,7 +144,7 @@ func (v *Virt) NetworkConnect(ctx context.Context, network, target, ipv4, ipv6 s
144144
}
145145

146146
// NetworkDisconnect disconnects from one network.
147-
func (v *Virt) NetworkDisconnect(ctx context.Context, network, target string, force bool) (err error) {
147+
func (v *Virt) NetworkDisconnect(ctx context.Context, network, target string, _ bool) (err error) {
148148
var req virttypes.DisconnectNetworkReq
149149
req.Network = network
150150
req.ID = target
@@ -171,12 +171,12 @@ func (v *Virt) NetworkList(ctx context.Context, drivers []string) (nets []*engin
171171
}
172172

173173
// BuildRefs builds references.
174-
func (v *Virt) BuildRefs(ctx context.Context, opts *enginetypes.BuildRefOptions) (refs []string) {
174+
func (v *Virt) BuildRefs(_ context.Context, opts *enginetypes.BuildRefOptions) (refs []string) {
175175
return []string{combineUserImage(opts.User, opts.Name)}
176176
}
177177

178178
// BuildContent builds content, the use of it is similar to BuildRefs.
179-
func (v *Virt) BuildContent(ctx context.Context, scm coresource.Source, opts *enginetypes.BuildContentOptions) (string, io.Reader, error) {
179+
func (v *Virt) BuildContent(_ context.Context, _ coresource.Source, _ *enginetypes.BuildContentOptions) (string, io.Reader, error) {
180180
return "", nil, coretypes.ErrEngineNotImplemented
181181
}
182182

@@ -228,7 +228,7 @@ func (v *Virt) VirtualizationCreate(ctx context.Context, opts *enginetypes.Virtu
228228
}
229229

230230
// VirtualizationCopyTo copies one.
231-
func (v *Virt) VirtualizationCopyTo(ctx context.Context, ID, dest string, content []byte, uid, gid int, mode int64) error {
231+
func (v *Virt) VirtualizationCopyTo(ctx context.Context, ID, dest string, content []byte, _, _ int, _ int64) error {
232232
return v.client.CopyToGuest(ctx, ID, dest, bytes.NewReader(content), true, true)
233233
}
234234

@@ -245,7 +245,7 @@ func (v *Virt) VirtualizationStop(ctx context.Context, ID string, gracefulTimeou
245245
}
246246

247247
// VirtualizationRemove removes a guest.
248-
func (v *Virt) VirtualizationRemove(ctx context.Context, ID string, volumes, force bool) (err error) {
248+
func (v *Virt) VirtualizationRemove(ctx context.Context, ID string, _, force bool) (err error) {
249249
if _, err = v.client.DestroyGuest(ctx, ID, force); err == nil {
250250
return nil
251251
}
@@ -299,7 +299,7 @@ func (v *Virt) VirtualizationLogs(ctx context.Context, opts *enginetypes.Virtual
299299
}
300300

301301
// VirtualizationAttach attaches something to a guest.
302-
func (v *Virt) VirtualizationAttach(ctx context.Context, ID string, stream, openStdin bool) (stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
302+
func (v *Virt) VirtualizationAttach(ctx context.Context, ID string, _, _ bool) (stdout, stderr io.ReadCloser, stdin io.WriteCloser, err error) {
303303
flags := virttypes.AttachGuestFlags{Safe: true, Force: true}
304304
_, attachGuest, err := v.client.AttachGuest(ctx, ID, []string{}, flags)
305305
if err != nil {
@@ -314,7 +314,7 @@ func (v *Virt) VirtualizationResize(ctx context.Context, ID string, height, widt
314314
}
315315

316316
// VirtualizationWait is waiting for a shut-off
317-
func (v *Virt) VirtualizationWait(ctx context.Context, ID, state string) (*enginetypes.VirtualizationWaitResult, error) {
317+
func (v *Virt) VirtualizationWait(ctx context.Context, ID, _ string) (*enginetypes.VirtualizationWaitResult, error) {
318318
r := &enginetypes.VirtualizationWaitResult{}
319319
msg, err := v.client.WaitGuest(ctx, ID, true)
320320
if err != nil {

‎resource/plugins/binary/binary.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Plugin struct {
1717
}
1818

1919
// NewPlugin .
20-
func NewPlugin(ctx context.Context, path string, config coretypes.Config) (*Plugin, error) {
20+
func NewPlugin(_ context.Context, path string, config coretypes.Config) (*Plugin, error) {
2121
p, err := filepath.Abs(path)
2222
if err != nil {
2323
return nil, err

‎resource/plugins/cpumem/metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// GetMetricsDescription .
13-
func (p Plugin) GetMetricsDescription(ctx context.Context) (*plugintypes.GetMetricsDescriptionResponse, error) {
13+
func (p Plugin) GetMetricsDescription(context.Context) (*plugintypes.GetMetricsDescriptionResponse, error) {
1414
resp := &plugintypes.GetMetricsDescriptionResponse{}
1515
return resp, mapstructure.Decode([]map[string]interface{}{
1616
{

‎rpc/rpc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Vibranium struct {
3232
}
3333

3434
// Info show core info
35-
func (v *Vibranium) Info(ctx context.Context, opts *pb.Empty) (*pb.CoreInfo, error) {
35+
func (v *Vibranium) Info(context.Context, *pb.Empty) (*pb.CoreInfo, error) {
3636
return &pb.CoreInfo{
3737
Version: version.VERSION,
3838
Revison: version.REVISION,

‎store/etcdv3/meta/etcd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (e *ETCD) GetOne(ctx context.Context, key string, opts ...clientv3.OpOption
117117
}
118118

119119
// GetMulti gets several results
120-
func (e *ETCD) GetMulti(ctx context.Context, keys []string, opts ...clientv3.OpOption) (kvs []*mvccpb.KeyValue, err error) {
120+
func (e *ETCD) GetMulti(ctx context.Context, keys []string, _ ...clientv3.OpOption) (kvs []*mvccpb.KeyValue, err error) {
121121
var txnResponse *clientv3.TxnResponse
122122
if len(keys) == 0 {
123123
return

‎store/redis/rediaron.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ type Rediaron struct {
6868
// New creates a new Rediaron instance from config
6969
// Only redis address and db is used
7070
// db is used to separate data, by default db 0 will be used
71-
func New(config types.Config, t *testing.T) (*Rediaron, error) {
71+
// TODO mock redis for testing
72+
func New(config types.Config, _ *testing.T) (*Rediaron, error) {
7273
cli := redis.NewClient(&redis.Options{
7374
Addr: config.Redis.Addr,
7475
DB: config.Redis.DB,

‎strategy/average.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// 容量够的机器每一台部署 N 个
1414
// need 是每台机器所需总量,limit 是限制节点数, 保证本轮增量部署 need*limit 个实例
1515
// limit = 0 即对所有节点部署
16-
func AveragePlan(ctx context.Context, infos []Info, need, total, limit int) (map[string]int, error) {
16+
func AveragePlan(ctx context.Context, infos []Info, need, _, limit int) (map[string]int, error) {
1717
log.WithFunc("strategy.AveragePlan").Debugf(ctx, "need %d limit %d infos %+v", need, limit, infos)
1818
scheduleInfosLength := len(infos)
1919
if limit == 0 {

‎strategy/communism.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func newInfoHeap(infos []Info, limit int) heap.Interface {
5757

5858
// CommunismPlan 吃我一记共产主义大锅饭
5959
// 部署完 N 个后全局尽可能平均
60-
func CommunismPlan(ctx context.Context, infos []Info, need, total, limit int) (map[string]int, error) {
60+
func CommunismPlan(_ context.Context, infos []Info, need, total, limit int) (map[string]int, error) {
6161
if total < need {
6262
return nil, errors.Wrapf(types.ErrInsufficientResource, "need: %d, available: %d", need, total)
6363
}

‎utils/cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ func (c *EngineCache) Get(endpoint string) engine.API {
3636
}
3737

3838
// Delete connection by host
39-
func (c *EngineCache) Delete(host string, endpoint ...string) {
39+
func (c *EngineCache) Delete(host string, _ ...string) {
4040
c.cache.Delete(host)
4141
}

‎utils/http.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func dumpFromString(ctx context.Context, ca, cert, key *os.File, caStr, certStr,
132132
return nil
133133
}
134134

135-
func checkRedirect(req *http.Request, via []*http.Request) error {
135+
func checkRedirect(_ *http.Request, via []*http.Request) error {
136136
if via[0].Method == http.MethodGet {
137137
return http.ErrUseLastResponse
138138
}

‎wal/hydro.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,21 @@ func (h *Hydro) recover(ctx context.Context, handler EventHandler, event HydroEv
116116
return err
117117
}
118118

119-
delete := func() error {
119+
del := func() error {
120120
return h.store.Delete(event.Key())
121121
}
122122

123123
switch handle, err := handler.Check(ctx, item); {
124124
case err != nil:
125125
return err
126126
case !handle:
127-
return delete()
127+
return del()
128128
default:
129129
if err := handler.Handle(ctx, item); err != nil {
130130
return err
131131
}
132132
}
133-
return delete()
133+
return del()
134134
}
135135

136136
func (h *Hydro) getEventHandler(eventyp string) (EventHandler, bool) {

‎wal/kv/mocked.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func NewMockedKV() *MockedKV {
2727
}
2828

2929
// Open .
30-
func (m *MockedKV) Open(path string, mode os.FileMode, timeout time.Duration) error {
30+
func (m *MockedKV) Open(string, os.FileMode, time.Duration) error {
3131
return nil
3232
}
3333

0 commit comments

Comments
 (0)
Please sign in to comment.