Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Oct 8, 2024
1 parent b1ce858 commit 4681961
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions internal/datasourcev2/polling_http_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ func (r *pollingRequester) Request() (*PollingResponse, error) {
version int
)

for obj := r.Object().WithRequiredProperties([]string{versionField, kindField, keyField, objectField}); obj.Next(); {
for obj := r.Object().WithRequiredProperties([]string{
versionField, kindField, keyField, objectField}); obj.Next(); {
switch string(obj.Name()) {
case versionField:
version = r.Int()
Expand Down Expand Up @@ -171,7 +172,6 @@ func (r *pollingRequester) Request() (*PollingResponse, error) {
}
}
updates = append(updates, fdv2proto.DeleteObject{Kind: kind, Key: key, Version: version})

}
case fdv2proto.EventPayloadTransferred:
//nolint:godox
Expand Down
4 changes: 0 additions & 4 deletions internal/datasourcev2/streaming_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ const (
versionField = "version"
objectField = "object"

putEventName = "put-object"
deleteEventName = "delete-object"

streamReadTimeout = 5 * time.Minute // the LaunchDarkly stream should send a heartbeat comment every 3 minutes
streamMaxRetryDelay = 30 * time.Second
streamRetryResetInterval = 60 * time.Second
Expand Down Expand Up @@ -136,7 +133,6 @@ func (sp *StreamProcessor) Start(closeWhenReady chan<- struct{}) {
go sp.subscribe(closeWhenReady)
}

//nolint:gocyclo,godox // this function is a stepping stone. It will get better over time.
func (sp *StreamProcessor) consumeStream(stream *es.Stream, closeWhenReady chan<- struct{}) {
// Consume remaining Events and Errors so we can garbage collect
defer func() {
Expand Down
2 changes: 2 additions & 0 deletions internal/fdv2proto/event_to_storable_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"github.com/launchdarkly/go-server-sdk/v7/subsystems/ldstoretypes"
)

// ToStorableItems converts a list of FDv2 events to a list of collections suitable for insertion
// into a data store.
func ToStorableItems(events []Event) []ldstoretypes.Collection {
flagCollection := ldstoretypes.Collection{
Kind: datakinds.Features,
Expand Down
4 changes: 1 addition & 3 deletions internal/fdv2proto/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
// IntentTransferChanges means the server intends to send only the necessary changes to bring
// an existing data set up-to-date.
IntentTransferChanges = IntentCode("xfer-changes")
//IntentNone means the server intends to send no data (payload is up to date).
// IntentNone means the server intends to send no data (payload is up to date).
IntentNone = IntentCode("none")
)

Expand Down Expand Up @@ -69,14 +69,12 @@ type ErrUnknownKind struct {
kind ObjectKind
}

//nolint:revive // Error method.
func (e *ErrUnknownKind) Is(err error) bool {

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / ldotel Linux, Go 1.23

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / ldotel Linux, Go 1.22

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / ldotel Linux, Go 1.18

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / Linux, Go 1.18 / Unit Tests and Coverage

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / Linux, Go 1.22 / Unit Tests and Coverage

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)

Check failure on line 72 in internal/fdv2proto/events.go

View workflow job for this annotation

GitHub Actions / Linux, Go 1.23 / Unit Tests and Coverage

exported: exported method ErrUnknownKind.Is should have comment or be unexported (revive)
var errUnknownKind *ErrUnknownKind
ok := errors.As(err, &errUnknownKind)
return ok
}

//nolint:revive // Error method.
func (e *ErrUnknownKind) Error() string {
return fmt.Sprintf("unknown object kind: %s", e.kind)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/fdv2proto/payloads.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fdv2proto

// Payload represents a payload delivered in a streaming response.
type Payload struct {
// The id here doesn't seem to match the state that is included in the
// Payload transferred object.
Expand All @@ -12,6 +13,7 @@ type Payload struct {
Reason string `json:"reason"`
}

// PollingPayload represents a payload that is delivered in a polling response.
type PollingPayload struct {
// Note: the first event in a PollingPayload should be a Payload.
Events []RawEvent `json:"events"`
Expand Down
3 changes: 2 additions & 1 deletion internal/sharedtest/mocks/mock_data_destination.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package mocks

import (
"github.com/launchdarkly/go-server-sdk/v7/internal/toposort"
"sync"
"testing"
"time"

"github.com/launchdarkly/go-server-sdk/v7/internal/toposort"

"github.com/launchdarkly/go-server-sdk/v7/internal/fdv2proto"

"github.com/launchdarkly/go-server-sdk/v7/interfaces"
Expand Down

0 comments on commit 4681961

Please sign in to comment.