Skip to content

Commit 7e98fa2

Browse files
committed
Applying coding styles suggestions.
1 parent 721a951 commit 7e98fa2

33 files changed

+335
-334
lines changed

cli/daemon/daemon.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ var CliCommand = cli.Command{
7575

7676
func reloadDaemon(c *cli.Context) error {
7777
if !c.Args().Present() {
78-
return fmt.Errorf("Daemon name required")
78+
return fmt.Errorf("daemon name required")
7979
}
8080
daemonName := c.Args().First()
8181
if !isValidDaemon(daemonName) {
82-
return fmt.Errorf("Invalid daemon name %s", daemonName)
82+
return fmt.Errorf("invalid daemon name %s", daemonName)
8383
}
8484
event := model.Event{
8585
UEI: "uei.opennms.org/internal/reloadDaemonConfig",

cli/daemon/daemon_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ func TestReloadDaemon(t *testing.T) {
5959
defer server.Close()
6060

6161
err = app.Run([]string{app.Name, "daemon", "reload"})
62-
assert.Error(t, err, "Daemon name required")
62+
assert.Error(t, err, "daemon name required")
6363

6464
err = app.Run([]string{app.Name, "daemon", "reload", "Weird"})
65-
assert.Error(t, err, "Invalid daemon name Weird")
65+
assert.Error(t, err, "invalid daemon name Weird")
6666

6767
err = app.Run([]string{app.Name, "daemon", "reload", "pollerd"})
6868
assert.NilError(t, err)

cli/nodes/assets.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func getFields(c *cli.Context) error {
5555
func getAssets(c *cli.Context) error {
5656
criteria := c.Args().Get(0)
5757
if criteria == "" {
58-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
58+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
5959
}
6060
record, err := services.GetNodesAPI(rest.Instance).GetAssetRecord(criteria)
6161
if err != nil {
@@ -69,7 +69,7 @@ func getAssets(c *cli.Context) error {
6969
func deleteAssetField(c *cli.Context) error {
7070
criteria := c.Args().Get(0)
7171
if criteria == "" {
72-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
72+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
7373
}
7474
field := c.Args().Get(1)
7575
if field == "" {
@@ -81,7 +81,7 @@ func deleteAssetField(c *cli.Context) error {
8181
func addAssetField(c *cli.Context) error {
8282
criteria := c.Args().Get(0)
8383
if criteria == "" {
84-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
84+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
8585
}
8686
field := c.Args().Get(1)
8787
if field == "" {
@@ -96,7 +96,7 @@ func addAssetField(c *cli.Context) error {
9696

9797
func setAssetField(criteria string, field string, value string) error {
9898
if !isValidField(field) {
99-
return fmt.Errorf("Invalid field %s", field)
99+
return fmt.Errorf("invalid field %s", field)
100100
}
101101
return services.GetNodesAPI(rest.Instance).SetAssetField(criteria, field, value)
102102
}

cli/nodes/categories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var CategoriesCliCommand = cli.Command{
3939
func getCategories(c *cli.Context) error {
4040
criteria := c.Args().Get(0)
4141
if criteria == "" {
42-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
42+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
4343
}
4444
list, err := services.GetNodesAPI(rest.Instance).GetCategories(criteria)
4545
if err != nil {
@@ -61,7 +61,7 @@ func getCategories(c *cli.Context) error {
6161
func deleteCategory(c *cli.Context) error {
6262
criteria := c.Args().Get(0)
6363
if criteria == "" {
64-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
64+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
6565
}
6666
name := c.Args().Get(1)
6767
if name == "" {
@@ -73,7 +73,7 @@ func deleteCategory(c *cli.Context) error {
7373
func addCategory(c *cli.Context) error {
7474
criteria := c.Args().Get(0)
7575
if criteria == "" {
76-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
76+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
7777
}
7878
name := c.Args().Get(1)
7979
if name == "" {

cli/nodes/ipinterfaces.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ var IPInterfacesCliCommand = cli.Command{
116116
func getIPInterfaces(c *cli.Context) error {
117117
criteria := c.Args().Get(0)
118118
if criteria == "" {
119-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
119+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
120120
}
121121
list, err := services.GetNodesAPI(rest.Instance).GetIPInterfaces(criteria)
122122
if err != nil {
@@ -138,19 +138,19 @@ func getIPInterfaces(c *cli.Context) error {
138138
func deleteIPInterface(c *cli.Context) error {
139139
criteria := c.Args().Get(0)
140140
if criteria == "" {
141-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
141+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
142142
}
143143
ipaddr := c.Args().Get(1)
144144
if ipaddr == "" {
145-
return fmt.Errorf("Interface IP Address is required")
145+
return fmt.Errorf("interface IP Address is required")
146146
}
147147
return services.GetNodesAPI(rest.Instance).DeleteIPInterface(criteria, ipaddr)
148148
}
149149

150150
func addIPInterface(c *cli.Context) error {
151151
criteria := c.Args().Get(0)
152152
if criteria == "" {
153-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
153+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
154154
}
155155
ip := &model.OnmsIPInterface{
156156
IPAddress: c.String("ipAddr"),
@@ -168,11 +168,11 @@ func addIPInterface(c *cli.Context) error {
168168
func listInterfaceMetadata(c *cli.Context) error {
169169
criteria := c.Args().Get(0)
170170
if criteria == "" {
171-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
171+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
172172
}
173173
ipaddr := c.Args().Get(1)
174174
if criteria == "" {
175-
return fmt.Errorf("Interface IP Address is required")
175+
return fmt.Errorf("interface IP Address is required")
176176
}
177177
meta, err := services.GetNodesAPI(rest.Instance).GetIPInterfaceMetadata(criteria, ipaddr)
178178
if err != nil {
@@ -194,11 +194,11 @@ func listInterfaceMetadata(c *cli.Context) error {
194194
func setInterfaceMetadata(c *cli.Context) error {
195195
criteria := c.Args().Get(0)
196196
if criteria == "" {
197-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
197+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
198198
}
199199
ipaddr := c.Args().Get(1)
200200
if ipaddr == "" {
201-
return fmt.Errorf("Interface IP Address is required")
201+
return fmt.Errorf("interface IP Address is required")
202202
}
203203
meta := model.MetaData{
204204
Context: c.String("context"),
@@ -214,19 +214,19 @@ func setInterfaceMetadata(c *cli.Context) error {
214214
func deleteInterfaceMetadata(c *cli.Context) error {
215215
criteria := c.Args().Get(0)
216216
if criteria == "" {
217-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
217+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
218218
}
219219
ipaddr := c.Args().Get(1)
220220
if ipaddr == "" {
221-
return fmt.Errorf("Interface IP Address is required")
221+
return fmt.Errorf("interface IP Address is required")
222222
}
223223
ctx := c.String("context")
224224
if ctx == "" {
225-
return fmt.Errorf("Context is required")
225+
return fmt.Errorf("context is required")
226226
}
227227
key := c.String("key")
228228
if key == "" {
229-
return fmt.Errorf("Key is required")
229+
return fmt.Errorf("key is required")
230230
}
231231
return services.GetNodesAPI(rest.Instance).DeleteIPInterfaceMetadata(criteria, ipaddr, ctx, key)
232232
}

cli/nodes/nodes.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func getNodes(c *cli.Context) error {
158158
func deleteNode(c *cli.Context) error {
159159
criteria := c.Args().Get(0)
160160
if criteria == "" {
161-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
161+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
162162
}
163163
return services.GetNodesAPI(rest.Instance).DeleteNode(criteria)
164164
}
@@ -202,7 +202,7 @@ func addNodes(c *cli.Context) error {
202202
func listNodeMetadata(c *cli.Context) error {
203203
criteria := c.Args().Get(0)
204204
if criteria == "" {
205-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
205+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
206206
}
207207
meta, err := services.GetNodesAPI(rest.Instance).GetNodeMetadata(criteria)
208208
if err != nil {
@@ -224,7 +224,7 @@ func listNodeMetadata(c *cli.Context) error {
224224
func setNodeMetadata(c *cli.Context) error {
225225
criteria := c.Args().Get(0)
226226
if criteria == "" {
227-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
227+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
228228
}
229229
meta := model.MetaData{
230230
Context: c.String("context"),
@@ -240,15 +240,15 @@ func setNodeMetadata(c *cli.Context) error {
240240
func deleteNodeMetadata(c *cli.Context) error {
241241
criteria := c.Args().Get(0)
242242
if criteria == "" {
243-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
243+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
244244
}
245245
ctx := c.String("context")
246246
if ctx == "" {
247-
return fmt.Errorf("Context is required")
247+
return fmt.Errorf("context is required")
248248
}
249249
key := c.String("key")
250250
if key == "" {
251-
return fmt.Errorf("Key is required")
251+
return fmt.Errorf("key is required")
252252
}
253253
return services.GetNodesAPI(rest.Instance).DeleteNodeMetadata(criteria, ctx, key)
254254
}

cli/nodes/services.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ var ServicesCliCommand = cli.Command{
9292
func getServices(c *cli.Context) error {
9393
criteria := c.Args().Get(0)
9494
if criteria == "" {
95-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
95+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
9696
}
9797
ipaddr := c.Args().Get(1)
9898
if criteria == "" {
99-
return fmt.Errorf("Interface IP Address is required")
99+
return fmt.Errorf("interface IP address is required")
100100
}
101101
list, err := services.GetNodesAPI(rest.Instance).GetMonitoredServices(criteria, ipaddr)
102102
if err != nil {
@@ -118,31 +118,31 @@ func getServices(c *cli.Context) error {
118118
func deleteService(c *cli.Context) error {
119119
criteria := c.Args().Get(0)
120120
if criteria == "" {
121-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
121+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
122122
}
123123
ipaddr := c.Args().Get(1)
124124
if criteria == "" {
125-
return fmt.Errorf("Interface IP Address is required")
125+
return fmt.Errorf("interface IP address is required")
126126
}
127127
svc := c.Args().Get(2)
128128
if criteria == "" {
129-
return fmt.Errorf("Monitored Service Name is required")
129+
return fmt.Errorf("monitored Service Name is required")
130130
}
131131
return services.GetNodesAPI(rest.Instance).DeleteMonitoredService(criteria, ipaddr, svc)
132132
}
133133

134134
func addService(c *cli.Context) error {
135135
criteria := c.Args().Get(0)
136136
if criteria == "" {
137-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
137+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
138138
}
139139
ipaddr := c.Args().Get(1)
140140
if criteria == "" {
141-
return fmt.Errorf("Interface IP Address is required")
141+
return fmt.Errorf("interface IP address is required")
142142
}
143143
svc := c.Args().Get(2)
144144
if criteria == "" {
145-
return fmt.Errorf("Monitored Service Name is required")
145+
return fmt.Errorf("monitored Service Name is required")
146146
}
147147
service := &model.OnmsMonitoredService{
148148
ServiceType: &model.OnmsServiceType{
@@ -158,15 +158,15 @@ func addService(c *cli.Context) error {
158158
func listServiceMetadata(c *cli.Context) error {
159159
criteria := c.Args().Get(0)
160160
if criteria == "" {
161-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
161+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
162162
}
163163
ipaddr := c.Args().Get(1)
164164
if ipaddr == "" {
165-
return fmt.Errorf("Interface IP Address is required")
165+
return fmt.Errorf("interface IP Address is required")
166166
}
167167
svc := c.Args().Get(2)
168168
if svc == "" {
169-
return fmt.Errorf("Monitored Service Name is required")
169+
return fmt.Errorf("monitored Service Name is required")
170170
}
171171
meta, err := services.GetNodesAPI(rest.Instance).GetMonitoredServiceMetadata(criteria, ipaddr, svc)
172172
if err != nil {
@@ -188,15 +188,15 @@ func listServiceMetadata(c *cli.Context) error {
188188
func setServiceMetadata(c *cli.Context) error {
189189
criteria := c.Args().Get(0)
190190
if criteria == "" {
191-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
191+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
192192
}
193193
ipaddr := c.Args().Get(1)
194194
if ipaddr == "" {
195-
return fmt.Errorf("Interface IP Address is required")
195+
return fmt.Errorf("interface IP address is required")
196196
}
197197
svc := c.Args().Get(2)
198198
if svc == "" {
199-
return fmt.Errorf("Monitored Service Name is required")
199+
return fmt.Errorf("monitored Service Name is required")
200200
}
201201
meta := model.MetaData{
202202
Context: c.String("context"),
@@ -212,23 +212,23 @@ func setServiceMetadata(c *cli.Context) error {
212212
func deleteServiceMetadata(c *cli.Context) error {
213213
criteria := c.Args().Get(0)
214214
if criteria == "" {
215-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
215+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
216216
}
217217
ipaddr := c.Args().Get(1)
218218
if ipaddr == "" {
219-
return fmt.Errorf("Interface IP Address is required")
219+
return fmt.Errorf("interface IP address is required")
220220
}
221221
svc := c.Args().Get(2)
222222
if svc == "" {
223-
return fmt.Errorf("Monitored Service Name is required")
223+
return fmt.Errorf("monitored Service Name is required")
224224
}
225225
ctx := c.String("context")
226226
if ctx == "" {
227-
return fmt.Errorf("Context is required")
227+
return fmt.Errorf("context is required")
228228
}
229229
key := c.String("key")
230230
if key == "" {
231-
return fmt.Errorf("Key is required")
231+
return fmt.Errorf("key is required")
232232
}
233233
return services.GetNodesAPI(rest.Instance).DeleteMonitoredServiceMetadata(criteria, ipaddr, svc, ctx, key)
234234
}

cli/nodes/snmpinterfaces.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var SnmpInterfacesCliCommand = cli.Command{
9090
func getSnmpInterfaces(c *cli.Context) error {
9191
criteria := c.Args().Get(0)
9292
if criteria == "" {
93-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
93+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
9494
}
9595
list, err := services.GetNodesAPI(rest.Instance).GetSnmpInterfaces(criteria)
9696
if err != nil {
@@ -112,23 +112,23 @@ func getSnmpInterfaces(c *cli.Context) error {
112112
func deleteSnmpInterface(c *cli.Context) error {
113113
criteria := c.Args().Get(0)
114114
if criteria == "" {
115-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
115+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
116116
}
117117
idx := c.Args().Get(1)
118118
if idx == "" {
119119
return fmt.Errorf("ifIndex is required")
120120
}
121121
ifIndex, err := strconv.Atoi(idx)
122122
if err != nil {
123-
return fmt.Errorf("Cannot parse ifIndex: %s", idx)
123+
return fmt.Errorf("cannot parse ifIndex: %s", idx)
124124
}
125125
return services.GetNodesAPI(rest.Instance).DeleteSnmpInterface(criteria, ifIndex)
126126
}
127127

128128
func addSnmpInterface(c *cli.Context) error {
129129
criteria := c.Args().Get(0)
130130
if criteria == "" {
131-
return fmt.Errorf("Either the nodeID or the foreignSource:foreignID combination is required")
131+
return fmt.Errorf("either the nodeID or the foreignSource:foreignID combination is required")
132132
}
133133
snmp := &model.OnmsSnmpInterface{
134134
IfIndex: c.Int("ifIndex"),

0 commit comments

Comments
 (0)