Skip to content

Commit

Permalink
enable golangci lint:misspell,bodyclose (#1206)
Browse files Browse the repository at this point in the history
Signed-off-by: silenceper <[email protected]>
  • Loading branch information
silenceper authored Oct 1, 2020
1 parent 7a6941d commit 2ca2c19
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ linters:
- gofmt
- golint
- goimports
- misspell
- bodyclose
#- interfacer
#- ineffassign
#- misspell
#- scopelint
#- structcheck
#- bodyclose
#- deadcode
#- depguard
#- dogsled
Expand Down
2 changes: 1 addition & 1 deletion adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
type Adapter struct {
basecmd.AdapterBase

// Message is printed on succesful startup
// Message is printed on successful startup
Message string
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
defaultHPAMaxReplicas int32 = 100
)

// createAndDeployNewHPA creates and deploy HPA in the cluster for specifed ScaledObject
// createAndDeployNewHPA creates and deploy HPA in the cluster for specified ScaledObject
func (r *ScaledObjectReconciler) createAndDeployNewHPA(logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject, gvkr *kedav1alpha1.GroupVersionKindResource) error {
hpaName := getHPAName(scaledObject)
logger.Info("Creating a new HPA", "HPA.Namespace", scaledObject.Namespace, "HPA.Name", hpaName)
Expand Down
1 change: 1 addition & 0 deletions pkg/scalers/azure/azure_aad_podidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func GetAzureADPodIdentityToken(audience string) (AADToken, error) {
if err != nil {
return token, err
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/scalers/azure_log_analytics_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (s *azureLogAnalyticsScaler) getAuthorizationToken() (tokenData, error) {

err = json.NewDecoder(bytes.NewReader(body)).Decode(&tokenInfo)
if err != nil {
return tokenData{}, fmt.Errorf(`Can't decode responce body to JSON after getting access token. Received body: "%s". Error: "%v"`, string(body), err)
return tokenData{}, fmt.Errorf(`Can't decode response body to JSON after getting access token. Received body: "%s". Error: "%v"`, string(body), err)
}

if statusCode == 200 {
Expand Down Expand Up @@ -495,7 +495,7 @@ func (s *azureLogAnalyticsScaler) runHTTP(request *http.Request, caller string)

body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, resp.StatusCode, fmt.Errorf("Error reading %s responce body: %v", caller, err)
return nil, resp.StatusCode, fmt.Errorf("Error reading %s response body: %v", caller, err)
}

return body, resp.StatusCode, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/kafka_scram_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// SHA256 hash generator function for SCRAM conversation
var SHA256 scram.HashGeneratorFcn = func() hash.Hash { return sha256.New() }

// SHA512 hash generator function for SCRAM converstaion
// SHA512 hash generator function for SCRAM conversation
var SHA512 scram.HashGeneratorFcn = func() hash.Hash { return sha512.New() }

// XDGSCRAMClient struct to perform SCRAM conversation
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/redis_streams_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func getRedisConnection(metadata *redisStreamsMetadata) (*redis.Client, error) {
}
}

// this does not guarentee successful connection
// this does not guarantee successful connection
c := redis.NewClient(options)

// confirm if connected
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Scaler interface {
// The scaler returns the metric values for a metric Name and criteria matching the selector
GetMetrics(ctx context.Context, metricName string, metricSelector labels.Selector) ([]external_metrics.ExternalMetricValue, error)

// Returns the metrics based on which this scaler determines that the ScaleTarget scales. This is used to contruct the HPA spec that is created for
// Returns the metrics based on which this scaler determines that the ScaleTarget scales. This is used to construct the HPA spec that is created for
// this scaled object. The labels used should match the selectors used in GetMetrics
GetMetricSpecForScaling() []v2beta2.MetricSpec

Expand Down
7 changes: 5 additions & 2 deletions pkg/scalers/stan_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ func (s *stanScaler) IsActive(ctx context.Context) (bool, error) {
}

if resp.StatusCode == 404 {
baseResp, _ := http.Get(s.getSTANChannelsEndpoint())

baseResp, err := http.Get(s.getSTANChannelsEndpoint())
if err != nil {
return false, err
}
defer baseResp.Body.Close()
if baseResp.StatusCode == 404 {
stanLog.Info("Streaming broker endpoint returned 404. Please ensure it has been created", "url", monitoringEndpoint, "channelName", s.metadata.subject)

Expand Down
2 changes: 1 addition & 1 deletion pkg/scaling/resolver/hashicorpvault_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (vh *HashicorpVaultHandler) Read(path string) (*vaultApi.Secret, error) {
return vh.client.Logical().Read(path)
}

// Stop is responsible for stoping the renew token proccess
// Stop is responsible for stoping the renew token process
func (vh *HashicorpVaultHandler) Stop() {
if vh.stopCh != nil {
vh.stopCh <- struct{}{}
Expand Down

0 comments on commit 2ca2c19

Please sign in to comment.