Skip to content

Commit

Permalink
(FFM-7832) Cleanup goreport issues (#149)
Browse files Browse the repository at this point in the history
* (MAINT) Fix goreport typos

* (FFM-7832) Fix goreport issues
  • Loading branch information
conormurray95 authored May 12, 2023
1 parent b3b5999 commit 4e28292
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 18 deletions.
11 changes: 7 additions & 4 deletions cache/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ import (
// e.g.
//
// some-key-1
// field-1: foobar
// field-2: fizzbuzz
//
// field-1: foobar
// field-2: fizzbuzz
//
// some-key-2
// field-1: hello-world
//
// field-1: hello-world
type Cache interface {
// Set sets a value in the cache for a given key and field
Set(ctx context.Context, key string, field string, value encoding.BinaryMarshaler) error
Expand All @@ -34,7 +37,7 @@ type Cache interface {
Get(ctx context.Context, key string, field string, v encoding.BinaryUnmarshaler) error
// GetByte gets the value of a field for a given key
GetByte(ctx context.Context, key string, field string) ([]byte, error)
// GetAll gets all of the fiels and their values for a given key
// GetAll gets all the fields and their values for a given key
GetAll(ctx context.Context, key string) (map[string][]byte, error)
// RemoveAll removes all the fields and their values for a given key
RemoveAll(ctx context.Context, key string)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ff-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *sdkClientMap) copy() map[string]*harness.CfClient {
return s.m
}

// keys implements the flag.Value interface and allows us to pass a comma seperated
// keys implements the flag.Value interface and allows us to pass a comma separated
// list of api keys e.g. -api-keys 123,456,789
type keys []string

Expand Down
2 changes: 1 addition & 1 deletion cmd/offline-data-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Usage of ./offline-data-gen:
-environments int
the number of environments to generate (default 2)
-factor int
the factor to apply to the number of features, segments and targets for each environmnet that's created (default 2)
the factor to apply to the number of features, segments and targets for each environment that's created (default 2)
-features int
baseline number of features to generate (default 1)
-segments int
Expand Down
2 changes: 1 addition & 1 deletion cmd/offline-data-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

func init() {
flag.IntVar(&numEnvironments, "environments", 2, "the number of environments to generate")
flag.IntVar(&factor, "factor", 2, "the factor to apply to the number of features, segments and targets for each environmnet that's created")
flag.IntVar(&factor, "factor", 2, "the factor to apply to the number of features, segments and targets for each environment that's created")
flag.IntVar(&features, "features", 1, "baseline number of features to generate")
flag.IntVar(&segments, "segments", 1, "baseline number of segments to generate")
flag.IntVar(&targets, "targets", 1, "baseline number of targets to generate")
Expand Down
2 changes: 1 addition & 1 deletion file_decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
extensionYAML = ".yaml"
)

// DecodeFile is a convienence function that creates a FileDecoder and calls Decode
// DecodeFile is a convenience function that creates a FileDecoder and calls Decode
func DecodeFile(fileSystem fs.FS, path string, v interface{}) error {
dec, err := NewFileDecoder(fileSystem, path)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion repository/target_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (m *mockCache) GetByte(ctx context.Context, key string, field string) ([]by
return m.getByte()
}

// GetAll gets all of the fiels and their values for a given key
// GetAll gets all the fields and their values for a given key
func (m *mockCache) GetAll(ctx context.Context, key string) (map[string][]byte, error) {
return m.getAll()
}
Expand Down
6 changes: 3 additions & 3 deletions services/admin_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewAdminService(l log.Logger, addr string, serviceToken string) (AdminServi
return AdminService{log: l, client: c}, nil
}

// PageAPIKeysInput contains the paramters required to make a GetEnvironments
// PageAPIKeysInput contains the parameters required to make a GetEnvironments
// request
type PageAPIKeysInput struct {
AccountIdentifier string
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r AdminService) PageAPIKeys(ctx context.Context, input PageAPIKeysInput) (
}, nil
}

// PageTargetsInput contains the paramters required to make a PageTargets
// PageTargetsInput contains the parameters required to make a PageTargets
// request
type PageTargetsInput struct {
AccountIdentifier string
Expand All @@ -108,7 +108,7 @@ type PageTargetsInput struct {
PageSize int
}

// PageTargetsResult contains the paramters required to make a PageTargets
// PageTargetsResult contains the parameters required to make a PageTargets
// request
type PageTargetsResult struct {
Targets []admingen.Target
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ func getFeatureFlag(identifier string, environment string) (*admin.Feature, erro
req.Header.Set("x-api-key", GetUserAccessToken())
return nil
})
if err != nil {
log.Error(err)
return nil, err
}

flagResponse, err := admin.ParseGetFeatureFlagResponse(response)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/segments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"net/http"
"testing"

"github.com/harness/ff-proxy/tests/e2e/testhelpers"

"github.com/harness/ff-proxy/gen/client"
"github.com/harness/ff-proxy/tests/e2e/testhelpers"

"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -90,6 +89,9 @@ func TestTargetSegments(t *testing.T) {
}

got, err := GetAllSegments(t, envID, token)
if err != nil {
t.Error(err)
}
// Assert the response
assert.NotNil(t, got)
assert.Equal(t, tt.want.StatusCode, got.StatusCode(), "expected http status code %d but got %d", tt.want.StatusCode, got.StatusCode())
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestMain(m *testing.M) {
os.Exit(exitVal)
}

// TestSetup performs setup before a test. This includes initalizing logging, and working
// TestSetup performs setup before a test. This includes initializing logging, and working
// out how to authenticate with the platform
func Setup() {
log.Infof("Global Test Setup")
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/testhelpers/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func CreateEnvironmentRemote(projectIdentifier string, environment, environmentN
req.Header.Set("content-type", "application/json")
AddAuthToken(context.Background(), req)
res, err := client.Client.Do(req)
if err != nil {
log.Error(err)
return nil, err
}

// ensure environment is created within cf
err = retry.Do(
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/testhelpers/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ func CreateProjectRemote(identifier string) (*http.Response, error) {
req.Header.Set("content-type", "application/json")
AddAuthToken(context.Background(), req)
res, err := client.Client.Do(req)
if err != nil {
log.Error(err)
return nil, err
}

// ensure project is created within cf
err = retry.Do(
Expand Down
4 changes: 2 additions & 2 deletions transport/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Endpoints struct {
Health endpoint.Endpoint
}

// NewEndpoints returns an initalised Endpoints where each endpoint invokes the
// NewEndpoints returns an initialised Endpoints where each endpoint invokes the
// corresponding method on the passed ProxyService
func NewEndpoints(p proxyservice.ProxyService) *Endpoints {
return &Endpoints{
Expand Down Expand Up @@ -55,7 +55,7 @@ func makePostAuthenticateEndpoint(s proxyservice.ProxyService) endpoint.Endpoint
// makeGetFeatureConfigsEndpoint is a function to convert a services GetFeatureConfig
// method to an endpoint
func makeGetFeatureConfigsEndpoint(s proxyservice.ProxyService) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (repsonse interface{}, err error) {
return func(ctx context.Context, request interface{}) (response interface{}, err error) {
req := request.(domain.FeatureConfigRequest)
featureConfigs, err := s.FeatureConfig(ctx, req)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion transport/http_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ func TestHTTPServer_StreamIntegration(t *testing.T) {
}
cancel()

t.Logf("Then %s will recieve the event(s)", key)
t.Logf("Then %s will receive the event(s)", key)
assert.ElementsMatch(t, tc.expectedEvents, actualEvents)

}
Expand Down

0 comments on commit 4e28292

Please sign in to comment.