opts: fix "unused-receiver", line-length-limit linting

opts/port.go:124:7: unused-receiver: method receiver 'p' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (p *PortOpt) Type() string {
          ^
    opts/mount.go:218:7: unused-receiver: method receiver 'm' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (m *MountOpt) Type() string {
          ^
    opts/quotedstring.go:16:7: unused-receiver: method receiver 's' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (s *QuotedString) Type() string {
          ^
    opts/secret.go:82:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *SecretOpt) Type() string {
          ^
    opts/opts_test.go:235: line-length-limit: line is 283 characters, out of limit 200 (revive)
            `foo.bar.baz.this.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbe`,
    opts/ulimit.go:61:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *UlimitOpt) Type() string {
          ^
    opts/weightdevice.go:82:7: unused-receiver: method receiver 'opt' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (opt *WeightdeviceOpt) Type() string {
          ^
    opts/throttledevice.go:103:7: unused-receiver: method receiver 'opt' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (opt *ThrottledeviceOpt) Type() string {
          ^
    opts/duration.go:49:7: unused-receiver: method receiver 'd' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (d *DurationOpt) Type() string {
          ^
    opts/network.go:109:7: unused-receiver: method receiver 'n' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (n *NetworkOpt) Type() string {
          ^
    opts/network.go:119:7: unused-receiver: method receiver 'n' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (n *NetworkOpt) String() string {
          ^
    opts/opts.go:113:7: unused-receiver: method receiver 'opts' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (opts *ListOpts) Type() string {
          ^
    opts/pull_behavior.go:13:7: unused-receiver: method receiver 'p' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (p *PullOpt) Type() string {
          ^
    opts/config.go:83:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *ConfigOpt) Type() string {
          ^
    opts/gpus.go:95:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *GpuOpts) Type() string {
          ^
    opts/pull_behavior.go:23:7: unused-receiver: method receiver 'p' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (p *PullOpt) IsBoolFlag() bool {
          ^
    opts/opts.go:183:7: unused-receiver: method receiver 'opts' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (opts *MapOpts) Type() string {
          ^
    opts/opts.go:361:7: unused-receiver: method receiver 'o' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (o *FilterOpt) Type() string {
          ^
    opts/opts.go:389:7: unused-receiver: method receiver 'c' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (c *NanoCPUs) Type() string {
          ^
    opts/opts.go:466:7: unused-receiver: method receiver 'm' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (m *MemBytes) Type() string {
          ^
    opts/opts.go:501:7: unused-receiver: method receiver 'm' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (m *MemSwapBytes) Type() string {
          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-02-17 13:37:39 +01:00
parent d0c3380ce4
commit f79193c22c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
13 changed files with 23 additions and 20 deletions

View File

@ -80,7 +80,7 @@ func (o *ConfigOpt) Set(value string) error {
}
// Type returns the type of this option
func (o *ConfigOpt) Type() string {
func (*ConfigOpt) Type() string {
return "config"
}

View File

@ -46,7 +46,7 @@ func (d *DurationOpt) Set(s string) error {
}
// Type returns the type of this option, which will be displayed in `--help` output
func (d *DurationOpt) Type() string {
func (*DurationOpt) Type() string {
return "duration"
}

View File

@ -92,7 +92,7 @@ func (o *GpuOpts) Set(value string) error {
}
// Type returns the type of this option
func (o *GpuOpts) Type() string {
func (*GpuOpts) Type() string {
return "gpu-request"
}

View File

@ -215,7 +215,7 @@ func (m *MountOpt) Set(value string) error {
}
// Type returns the type of this option
func (m *MountOpt) Type() string {
func (*MountOpt) Type() string {
return "mount"
}

View File

@ -106,7 +106,7 @@ func (n *NetworkOpt) Set(value string) error { //nolint:gocyclo
}
// Type returns the type of this option
func (n *NetworkOpt) Type() string {
func (*NetworkOpt) Type() string {
return "network"
}
@ -116,7 +116,7 @@ func (n *NetworkOpt) Value() []NetworkAttachmentOpts {
}
// String returns the network opts as a string
func (n *NetworkOpt) String() string {
func (*NetworkOpt) String() string {
return ""
}

View File

@ -110,7 +110,7 @@ func (opts *ListOpts) Len() int {
}
// Type returns a string name for this Option type
func (opts *ListOpts) Type() string {
func (*ListOpts) Type() string {
return "list"
}
@ -180,7 +180,7 @@ func (opts *MapOpts) String() string {
}
// Type returns a string name for this Option type
func (opts *MapOpts) Type() string {
func (*MapOpts) Type() string {
return "map"
}
@ -358,7 +358,7 @@ func (o *FilterOpt) Set(value string) error {
}
// Type returns the option type
func (o *FilterOpt) Type() string {
func (*FilterOpt) Type() string {
return "filter"
}
@ -386,7 +386,7 @@ func (c *NanoCPUs) Set(value string) error {
}
// Type returns the type
func (c *NanoCPUs) Type() string {
func (*NanoCPUs) Type() string {
return "decimal"
}
@ -463,7 +463,7 @@ func (m *MemBytes) Set(value string) error {
}
// Type returns the type
func (m *MemBytes) Type() string {
func (*MemBytes) Type() string {
return "bytes"
}
@ -498,7 +498,7 @@ func (m *MemSwapBytes) Set(value string) error {
}
// Type returns the type
func (m *MemSwapBytes) Type() string {
func (*MemSwapBytes) Type() string {
return "bytes"
}

View File

@ -190,7 +190,6 @@ func TestListOptsWithValidator(t *testing.T) {
}
}
//nolint:lll
func TestValidateDNSSearch(t *testing.T) {
valid := []string{
`.`,
@ -232,7 +231,11 @@ func TestValidateDNSSearch(t *testing.T) {
`foo.bar-.baz`,
`foo.-bar`,
`foo.-bar.baz`,
`foo.bar.baz.this.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbethis.should.fail.on.long.name.because.it.is.longer.thanisshouldbe`,
`foo.bar.baz.` +
`this.should.fail.on.long.name.because.it.is.longer.thanisshouldbe` +
`this.should.fail.on.long.name.because.it.is.longer.thanisshouldbe` +
`this.should.fail.on.long.name.because.it.is.longer.thanisshouldbe` +
`this.should.fail.on.long.name.because.it.is.longer.thanisshouldbe`,
}
for _, domain := range valid {

View File

@ -121,7 +121,7 @@ func (p *PortOpt) Set(value string) error {
}
// Type returns the type of this option
func (p *PortOpt) Type() string {
func (*PortOpt) Type() string {
return "port"
}

View File

@ -13,7 +13,7 @@ func (s *QuotedString) Set(val string) error {
}
// Type returns the type of the value
func (s *QuotedString) Type() string {
func (*QuotedString) Type() string {
return "string"
}

View File

@ -79,7 +79,7 @@ func (o *SecretOpt) Set(value string) error {
}
// Type returns the type of this option
func (o *SecretOpt) Type() string {
func (*SecretOpt) Type() string {
return "secret"
}

View File

@ -100,6 +100,6 @@ func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
}
// Type returns the option type
func (opt *ThrottledeviceOpt) Type() string {
func (*ThrottledeviceOpt) Type() string {
return "list"
}

View File

@ -58,6 +58,6 @@ func (o *UlimitOpt) GetList() []*container.Ulimit {
}
// Type returns the option type
func (o *UlimitOpt) Type() string {
func (*UlimitOpt) Type() string {
return "ulimit"
}

View File

@ -79,6 +79,6 @@ func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice {
}
// Type returns the option type
func (opt *WeightdeviceOpt) Type() string {
func (*WeightdeviceOpt) Type() string {
return "list"
}