Skip to content

Commit 972b6b1

Browse files
committed
ci: enable unparam linter
And fix the last warning from it: match.go:31:20: `withMatchType` - `typ` always receives `"signal"` (unparam) func withMatchType(typ string) MatchOption { ^ Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent f754e57 commit 972b6b1

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ linters:
44
enable:
55
- gofumpt
66
- unconvert
7+
- unparam

conn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ func (conn *Conn) AddMatchSignal(options ...MatchOption) error {
629629

630630
// AddMatchSignalContext acts like AddMatchSignal but takes a context.
631631
func (conn *Conn) AddMatchSignalContext(ctx context.Context, options ...MatchOption) error {
632-
options = append([]MatchOption{withMatchType("signal")}, options...)
632+
options = append([]MatchOption{withMatchTypeSignal()}, options...)
633633
return conn.busObj.CallWithContext(
634634
ctx,
635635
"org.freedesktop.DBus.AddMatch", 0,
@@ -644,7 +644,7 @@ func (conn *Conn) RemoveMatchSignal(options ...MatchOption) error {
644644

645645
// RemoveMatchSignalContext acts like RemoveMatchSignal but takes a context.
646646
func (conn *Conn) RemoveMatchSignalContext(ctx context.Context, options ...MatchOption) error {
647-
options = append([]MatchOption{withMatchType("signal")}, options...)
647+
options = append([]MatchOption{withMatchTypeSignal()}, options...)
648648
return conn.busObj.CallWithContext(
649649
ctx,
650650
"org.freedesktop.DBus.RemoveMatch", 0,

match.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func WithMatchOption(key, value string) MatchOption {
2626
return MatchOption{key, value}
2727
}
2828

29-
// doesn't make sense to export this option because clients can only
30-
// subscribe to messages with signal type.
31-
func withMatchType(typ string) MatchOption {
32-
return WithMatchOption("type", typ)
29+
// It does not make sense to have a public WithMatchType function
30+
// because clients can only subscribe to messages with signal type.
31+
func withMatchTypeSignal() MatchOption {
32+
return WithMatchOption("type", "signal")
3333
}
3434

3535
// WithMatchSender sets sender match option.

match_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "testing"
44

55
func TestFormatMatchOptions(t *testing.T) {
66
opts := []MatchOption{
7-
withMatchType("signal"),
7+
withMatchTypeSignal(),
88
WithMatchSender("org.bluez"),
99
WithMatchInterface("org.freedesktop.DBus.Properties"),
1010
WithMatchMember("PropertiesChanged"),

object.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (o *Object) CallWithContext(ctx context.Context, method string, flags Flags
4646
// Deprecated: use (*Conn) AddMatchSignal instead.
4747
func (o *Object) AddMatchSignal(iface, member string, options ...MatchOption) *Call {
4848
base := []MatchOption{
49-
withMatchType("signal"),
49+
withMatchTypeSignal(),
5050
WithMatchInterface(iface),
5151
WithMatchMember(member),
5252
}
@@ -65,7 +65,7 @@ func (o *Object) AddMatchSignal(iface, member string, options ...MatchOption) *C
6565
// Deprecated: use (*Conn) RemoveMatchSignal instead.
6666
func (o *Object) RemoveMatchSignal(iface, member string, options ...MatchOption) *Call {
6767
base := []MatchOption{
68-
withMatchType("signal"),
68+
withMatchTypeSignal(),
6969
WithMatchInterface(iface),
7070
WithMatchMember(member),
7171
}

0 commit comments

Comments
 (0)