Skip to content

Commit a75c200

Browse files
committed
Fix lint warnings / comments.
1 parent 7c2dbdf commit a75c200

File tree

10 files changed

+27
-4
lines changed

10 files changed

+27
-4
lines changed

internal/backend/basicstation/backend.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,22 @@ func NewBackend(conf config.Config) (*Backend, error) {
193193
return &b, nil
194194
}
195195

196+
// GetDownlinkTXAckChan returns the channel for downlink tx acknowledgements.
196197
func (b *Backend) GetDownlinkTXAckChan() chan gw.DownlinkTXAck {
197198
return b.downlinkTXAckChan
198199
}
199200

201+
// GetGatewayStatsChan returns the channel for gateway statistics.
200202
func (b *Backend) GetGatewayStatsChan() chan gw.GatewayStats {
201203
return b.gatewayStatsChan
202204
}
203205

206+
// GetUplinkFrameChan returns the channel for received uplinks.
204207
func (b *Backend) GetUplinkFrameChan() chan gw.UplinkFrame {
205208
return b.uplinkFrameChan
206209
}
207210

211+
// GetSubscribeEventChan returns the channel for the (un)subscribe events.
208212
func (b *Backend) GetSubscribeEventChan() chan events.Subscribe {
209213
return b.gateways.subscribeEventChan
210214
}
@@ -214,6 +218,7 @@ func (b *Backend) GetRawPacketForwarderEventChan() chan gw.RawPacketForwarderEve
214218
return b.rawPacketForwarderEventChan
215219
}
216220

221+
// SendDownlinkFrame sends the given downlink frame.
217222
func (b *Backend) SendDownlinkFrame(df gw.DownlinkFrame) error {
218223
b.Lock()
219224
defer b.Unlock()
@@ -254,6 +259,7 @@ func (b *Backend) SendDownlinkFrame(df gw.DownlinkFrame) error {
254259
return nil
255260
}
256261

262+
// ApplyConfiguration applies the given configuration to the gateway.
257263
func (b *Backend) ApplyConfiguration(gwConfig gw.GatewayConfiguration) error {
258264
rc, err := structs.GetRouterConfigOld(b.region, b.netIDs, b.joinEUIs, b.frequencyMin, b.frequencyMax, gwConfig)
259265
if err != nil {

internal/backend/basicstation/structs/downlink_message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/brocaar/lorawan/band"
1515
)
1616

17-
// DownlinkMessage implements the downlink message.
17+
// DownlinkFrame implements the downlink message.
1818
type DownlinkFrame struct {
1919
MessageType MessageType `json:"msgtype"`
2020

internal/backend/basicstation/structs/radio_meta_data.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type RadioMetaDataUpInfo struct {
2929
SNR float32 `json:"snr"`
3030
}
3131

32+
// SetRadioMetaDataToProto sets the given parameters to the given protobuf struct.
3233
func SetRadioMetaDataToProto(loraBand band.Band, gatewayID lorawan.EUI64, rmd RadioMetaData, pb *gw.UplinkFrame) error {
3334
//
3435
// TxInfo

internal/backend/concentratord/concentratord.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,33 @@ func (b *Backend) getGatewayID() (lorawan.EUI64, error) {
9191
return gatewayID, nil
9292
}
9393

94+
// Close closes the backend.
9495
func (b *Backend) Close() error {
9596
b.eventSock.Close()
9697
return nil
9798
}
9899

100+
// GetDownlinkTXAckChan returns the channel for downlink tx acknowledgements.
99101
func (b *Backend) GetDownlinkTXAckChan() chan gw.DownlinkTXAck {
100102
return b.downlinkTXAckChan
101103
}
102104

105+
// GetGatewayStatsChan returns the channel for gateway statistics.
103106
func (b *Backend) GetGatewayStatsChan() chan gw.GatewayStats {
104107
return b.gatewayStatsChan
105108
}
106109

110+
// GetUplinkFrameChan returns the channel for received uplinks.
107111
func (b *Backend) GetUplinkFrameChan() chan gw.UplinkFrame {
108112
return b.uplinkFrameChan
109113
}
110114

115+
// GetSubscribeEventChan returns the channel for the (un)subscribe events.
111116
func (b *Backend) GetSubscribeEventChan() chan events.Subscribe {
112117
return b.subscribeEventChan
113118
}
114119

120+
// SendDownlinkFrame sends the given downlink frame.
115121
func (b *Backend) SendDownlinkFrame(pl gw.DownlinkFrame) error {
116122
loRaModInfo := pl.GetTxInfo().GetLoraModulationInfo()
117123
if loRaModInfo != nil {
@@ -130,7 +136,7 @@ func (b *Backend) SendDownlinkFrame(pl gw.DownlinkFrame) error {
130136
log.WithError(err).Fatal("backend/concentratord: send downlink command error")
131137
}
132138
if len(bb) == 0 {
133-
return errors.New("no reply receieved, check concentratord logs for error!")
139+
return errors.New("no reply receieved, check concentratord logs for error")
134140
}
135141

136142
var ack gw.DownlinkTXAck
@@ -143,14 +149,17 @@ func (b *Backend) SendDownlinkFrame(pl gw.DownlinkFrame) error {
143149
return nil
144150
}
145151

152+
// ApplyConfiguration is not implemented.
146153
func (b *Backend) ApplyConfiguration(gw.GatewayConfiguration) error {
147154
return nil
148155
}
149156

157+
// GetRawPacketForwarderEventChan returns nil.
150158
func (b *Backend) GetRawPacketForwarderEventChan() chan gw.RawPacketForwarderEvent {
151159
return nil
152160
}
153161

162+
// RawPacketForwarderCommand is not implemented.
154163
func (b *Backend) RawPacketForwarderCommand(gw.RawPacketForwarderCommand) error {
155164
return nil
156165
}

internal/commands/commands.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"github.com/pkg/errors"
1414
log "github.com/sirupsen/logrus"
1515

16+
"github.com/brocaar/chirpstack-api/go/v3/gw"
1617
"github.com/brocaar/chirpstack-gateway-bridge/internal/config"
1718
"github.com/brocaar/chirpstack-gateway-bridge/internal/integration"
18-
"github.com/brocaar/chirpstack-api/go/v3/gw"
1919
"github.com/brocaar/lorawan"
2020
)
2121

@@ -158,6 +158,7 @@ func execute(command string, stdin []byte, environment map[string]string) ([]byt
158158
return stdoutB, stderrB, nil
159159
}
160160

161+
// ParseCommandLine parses the given command to commands and arguments.
161162
// source: https://stackoverflow.com/questions/34118732/parse-a-command-line-string-into-flags-and-arguments-in-golang
162163
func ParseCommandLine(command string) ([]string, error) {
163164
var args []string

internal/filters/filters.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
var netIDs []lorawan.NetID
1414
var joinEUIs [][2]lorawan.EUI64
1515

16+
// Setup configures the filters package.
1617
func Setup(conf config.Config) error {
1718
for _, netIDStr := range conf.Filters.NetIDs {
1819
var netID lorawan.NetID

internal/forwarder/forwarder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
var alwaysSubscribe []lorawan.EUI64
1717

18+
// Setup configures the forwarder.
1819
func Setup(conf config.Config) error {
1920
b := backend.GetBackend()
2021
i := integration.GetIntegration()

internal/integration/integration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const (
2121

2222
var integration Integration
2323

24+
// Setup configures the integration.
2425
func Setup(conf config.Config) error {
2526
var err error
2627
integration, err = mqtt.NewBackend(conf)
@@ -36,6 +37,7 @@ func GetIntegration() Integration {
3637
return integration
3738
}
3839

40+
// Integration defines the interface that an integration must implement.
3941
type Integration interface {
4042
// SetGatewaySubscription updates the gateway subscription for the given
4143
// gateway ID. The integration must implement this such that it is safe

internal/integration/mqtt/backend.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (b *Backend) GetGatewayConfigurationChan() chan gw.GatewayConfiguration {
160160
return b.gatewayConfigurationChan
161161
}
162162

163-
// GetGatewayCommandExecRequestChan() returns the channel for gateway command execution.
163+
// GetGatewayCommandExecRequestChan returns the channel for gateway command execution.
164164
func (b *Backend) GetGatewayCommandExecRequestChan() chan gw.GatewayCommandExecRequest {
165165
return b.gatewayCommandExecRequestChan
166166
}
@@ -170,6 +170,7 @@ func (b *Backend) GetRawPacketForwarderChan() chan gw.RawPacketForwarderCommand
170170
return b.rawPacketForwarderCommandChan
171171
}
172172

173+
// SetGatewaySubscription (un)subscribes the given gateway.
173174
func (b *Backend) SetGatewaySubscription(subscribe bool, gatewayID lorawan.EUI64) error {
174175
b.Lock()
175176
defer b.Unlock()

internal/metrics/metrics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/brocaar/chirpstack-gateway-bridge/internal/config"
1010
)
1111

12+
// Setup configures the metrics package.
1213
func Setup(conf config.Config) error {
1314
if !conf.Metrics.Prometheus.EndpointEnabled {
1415
return nil

0 commit comments

Comments
 (0)