Skip to content

Commit

Permalink
refactor: remove unused struct field (#458)
Browse files Browse the repository at this point in the history
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

- removes unused struct field in filepath sync

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

### Notes
<!-- any additional notes for this PR -->

### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->

### How to test
<!-- if applicable, add testing instructions under this section -->

---------

Signed-off-by: James Milligan <james@omnant.co.uk>
Signed-off-by: James Milligan <75740990+james-milligan@users.noreply.github.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
  • Loading branch information
james-milligan and Kavindu-Dodan authored Mar 3, 2023
1 parent b4ee495 commit a04c0b8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions pkg/sync/file/filepath_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (

type Sync struct {
URI string
Source string
Logger *logger.Logger
ProviderArgs sync.ProviderArgs
// FileType indicates the file type e.g., json, yaml/yml etc.,
Expand Down Expand Up @@ -134,7 +133,7 @@ func (fs *Sync) sendDataSync(ctx context.Context, syncType sync.Type, dataSync c
}
}

dataSync <- sync.DataSync{FlagData: msg, Source: fs.Source, Type: syncType}
dataSync <- sync.DataSync{FlagData: msg, Source: fs.URI, Type: syncType}
}

func (fs *Sync) fetch(_ context.Context) (string, error) {
Expand Down
2 changes: 0 additions & 2 deletions pkg/sync/file/filepath_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func TestSimpleReSync(t *testing.T) {
handler := Sync{
URI: fmt.Sprintf("%s/%s", fetchDirName, fetchFileName),
Logger: logger.NewLogger(nil, false),
Source: fmt.Sprintf("%s/%s", fetchDirName, fetchFileName),
}

for test, tt := range tests {
Expand Down Expand Up @@ -152,7 +151,6 @@ func TestSimpleSync(t *testing.T) {
URI: fmt.Sprintf("%s/%s", fetchDirName, fetchFileName),
Logger: logger.NewLogger(nil, false),
Mux: &msync.RWMutex{},
Source: fmt.Sprintf("%s/%s", fetchDirName, fetchFileName),
}
err := handler.Init(ctx)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/sync/grpc/grpc_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Sync struct {
Target string
ProviderID string
Logger *logger.Logger

syncClient syncv1grpc.FlagSyncService_SyncFlagsClient
client syncv1grpc.FlagSyncServiceClient
options []grpc.DialOption
Expand Down
3 changes: 2 additions & 1 deletion pkg/sync/http/http_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ type Sync struct {
LastBodySHA string
Logger *logger.Logger
ProviderArgs sync.ProviderArgs
ready bool

ready bool
}

// Client defines the behaviour required of a http client
Expand Down
9 changes: 4 additions & 5 deletions pkg/sync/kubernetes/kubernetes_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type Sync struct {
ProviderArgs sync.ProviderArgs
URI string

Source string
ready bool
namespace string
crdName string
Expand All @@ -45,7 +44,7 @@ func (k *Sync) ReSync(ctx context.Context, dataSync chan<- sync.DataSync) error
if err != nil {
return err
}
dataSync <- sync.DataSync{FlagData: fetch, Source: k.Source, Type: sync.ALL}
dataSync <- sync.DataSync{FlagData: fetch, Source: k.URI, Type: sync.ALL}
return nil
}

Expand Down Expand Up @@ -100,7 +99,7 @@ func (k *Sync) Sync(ctx context.Context, dataSync chan<- sync.DataSync) error {
return err
}

dataSync <- sync.DataSync{FlagData: fetch, Source: k.Source, Type: sync.ALL}
dataSync <- sync.DataSync{FlagData: fetch, Source: k.URI, Type: sync.ALL}

notifies := make(chan INotify)

Expand Down Expand Up @@ -139,7 +138,7 @@ func (k *Sync) watcher(ctx context.Context, notifies chan INotify, dataSync chan
continue
}

dataSync <- sync.DataSync{FlagData: msg, Source: k.Source, Type: sync.ALL}
dataSync <- sync.DataSync{FlagData: msg, Source: k.URI, Type: sync.ALL}
case DefaultEventTypeModify:
k.Logger.Debug("Configuration modified")
msg, err := k.fetch(ctx)
Expand All @@ -148,7 +147,7 @@ func (k *Sync) watcher(ctx context.Context, notifies chan INotify, dataSync chan
continue
}

dataSync <- sync.DataSync{FlagData: msg, Source: k.Source, Type: sync.ALL}
dataSync <- sync.DataSync{FlagData: msg, Source: k.URI, Type: sync.ALL}
case DefaultEventTypeDelete:
k.Logger.Debug("configuration deleted")
case DefaultEventTypeReady:
Expand Down

0 comments on commit a04c0b8

Please sign in to comment.