Skip to content

Commit 777e73a

Browse files
author
Luca Bruno
authored
Merge pull request #369 from kolyshkin/fix-deprecated
dbus: fix deprecated marks and docs
2 parents 2aca22e + 4685925 commit 777e73a

File tree

2 files changed

+158
-181
lines changed

2 files changed

+158
-181
lines changed

dbus/dbus.go

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@ type Conn struct {
111111
}
112112
}
113113

114-
// New establishes a connection to any available bus and authenticates.
115-
// Callers should call Close() when done with the connection.
116-
// Deprecated: use NewWithContext instead
114+
// Deprecated: use NewWithContext instead.
117115
func New() (*Conn, error) {
118116
return NewWithContext(context.Background())
119117
}
120118

121-
// NewWithContext same as New with context
119+
// NewWithContext establishes a connection to any available bus and authenticates.
120+
// Callers should call Close() when done with the connection.
122121
func NewWithContext(ctx context.Context) (*Conn, error) {
123122
conn, err := NewSystemConnectionContext(ctx)
124123
if err != nil && os.Geteuid() == 0 {
@@ -127,44 +126,41 @@ func NewWithContext(ctx context.Context) (*Conn, error) {
127126
return conn, err
128127
}
129128

130-
// NewSystemConnection establishes a connection to the system bus and authenticates.
131-
// Callers should call Close() when done with the connection
132-
// Deprecated: use NewSystemConnectionContext instead
129+
// Deprecated: use NewSystemConnectionContext instead.
133130
func NewSystemConnection() (*Conn, error) {
134131
return NewSystemConnectionContext(context.Background())
135132
}
136133

137-
// NewSystemConnectionContext same as NewSystemConnection with context
134+
// NewSystemConnectionContext establishes a connection to the system bus and authenticates.
135+
// Callers should call Close() when done with the connection.
138136
func NewSystemConnectionContext(ctx context.Context) (*Conn, error) {
139137
return NewConnection(func() (*dbus.Conn, error) {
140138
return dbusAuthHelloConnection(ctx, dbus.SystemBusPrivate)
141139
})
142140
}
143141

144-
// NewUserConnection establishes a connection to the session bus and
145-
// authenticates. This can be used to connect to systemd user instances.
146-
// Callers should call Close() when done with the connection.
147-
// Deprecated: use NewUserConnectionContext instead
142+
// Deprecated: use NewUserConnectionContext instead.
148143
func NewUserConnection() (*Conn, error) {
149144
return NewUserConnectionContext(context.Background())
150145
}
151146

152-
// NewUserConnectionContext same as NewUserConnection with context
147+
// NewUserConnectionContext establishes a connection to the session bus and
148+
// authenticates. This can be used to connect to systemd user instances.
149+
// Callers should call Close() when done with the connection.
153150
func NewUserConnectionContext(ctx context.Context) (*Conn, error) {
154151
return NewConnection(func() (*dbus.Conn, error) {
155152
return dbusAuthHelloConnection(ctx, dbus.SessionBusPrivate)
156153
})
157154
}
158155

159-
// NewSystemdConnection establishes a private, direct connection to systemd.
160-
// This can be used for communicating with systemd without a dbus daemon.
161-
// Callers should call Close() when done with the connection.
162-
// Deprecated: use NewSystemdConnectionContext instead
156+
// Deprecated: use NewSystemdConnectionContext instead.
163157
func NewSystemdConnection() (*Conn, error) {
164158
return NewSystemdConnectionContext(context.Background())
165159
}
166160

167-
// NewSystemdConnectionContext same as NewSystemdConnection with context
161+
// NewSystemdConnectionContext establishes a private, direct connection to systemd.
162+
// This can be used for communicating with systemd without a dbus daemon.
163+
// Callers should call Close() when done with the connection.
168164
func NewSystemdConnectionContext(ctx context.Context) (*Conn, error) {
169165
return NewConnection(func() (*dbus.Conn, error) {
170166
// We skip Hello when talking directly to systemd.
@@ -174,7 +170,7 @@ func NewSystemdConnectionContext(ctx context.Context) (*Conn, error) {
174170
})
175171
}
176172

177-
// Close closes an established connection
173+
// Close closes an established connection.
178174
func (c *Conn) Close() {
179175
c.sysconn.Close()
180176
c.sigconn.Close()
@@ -217,7 +213,7 @@ func NewConnection(dialBus func() (*dbus.Conn, error)) (*Conn, error) {
217213

218214
// GetManagerProperty returns the value of a property on the org.freedesktop.systemd1.Manager
219215
// interface. The value is returned in its string representation, as defined at
220-
// https://developer.gnome.org/glib/unstable/gvariant-text.html
216+
// https://developer.gnome.org/glib/unstable/gvariant-text.html.
221217
func (c *Conn) GetManagerProperty(prop string) (string, error) {
222218
variant, err := c.sysobj.GetProperty("org.freedesktop.systemd1.Manager." + prop)
223219
if err != nil {

0 commit comments

Comments
 (0)