fix: golangci-lint and gosec warnings

This commit is contained in:
2021-05-16 23:02:46 +02:00
parent f7bb283784
commit ffbc8a793c
22 changed files with 228 additions and 157 deletions

View File

@ -14,7 +14,7 @@ var (
// FilterMeasuredValuesByTypes filters measured values by type
func FilterMeasuredValuesByTypes(ctx context.Context, inChannel <-chan *types.MeasuredValue, measuredValueTypes ...types.MeasuredValueType) <-chan *types.MeasuredValue {
outChannel := make(chan *types.MeasuredValue, 0)
outChannel := make(chan *types.MeasuredValue, 1)
go func() {
LOOP:
for {
@ -40,7 +40,7 @@ func FilterMeasuredValuesByTypes(ctx context.Context, inChannel <-chan *types.Me
// FilterMeasuredValuesBySensorIDs filters measured values by sensor id
func FilterMeasuredValuesBySensorIDs(ctx context.Context, inChannel <-chan *types.MeasuredValue, sensorIDs ...string) <-chan *types.MeasuredValue {
outChannel := make(chan *types.MeasuredValue, 0)
outChannel := make(chan *types.MeasuredValue, 1)
go func() {
LOOP:
for {
@ -68,8 +68,8 @@ func FilterMeasuredValuesBySensorIDs(ctx context.Context, inChannel <-chan *type
// closed. The returned channels will be closed
func ReadPipeline(ctx context.Context, sensors ...Sensor) (<-chan *types.MeasuredValue, <-chan error) {
var (
errorChannel = make(chan error, 0)
measuredValueChannel = make(chan *types.MeasuredValue, 0)
errorChannel = make(chan error, 1)
measuredValueChannel = make(chan *types.MeasuredValue, 1)
)
go func() {
@ -102,8 +102,8 @@ func ReadPipeline(ctx context.Context, sensors ...Sensor) (<-chan *types.Measure
// the context has been closed
func ReadTickingPipeline(ctx context.Context, sensors ...Sensor) (<-chan *types.MeasuredValue, <-chan error) {
var (
errorChannel = make(chan error, 0)
measuredValueChannel = make(chan *types.MeasuredValue, 0)
errorChannel = make(chan error, 1)
measuredValueChannel = make(chan *types.MeasuredValue, 1)
)
for i := range sensors {