Skip to content

Commit

Permalink
chore(ci): adjust golangci-lint config, fix reported (#4451)
Browse files Browse the repository at this point in the history
  • Loading branch information
programmer04 committed Aug 3, 2023
1 parent 5549061 commit 7e567cc
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
run:
timeout: 5m
skip-dirs:
- pkg/clientset
- pkg/apis
- config
build-tags:
- integration_tests
- e2e_tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func startKongAdminAPIServiceReconciler(ctx context.Context, t *testing.T, clien
}()
t.Cleanup(func() { wg.Wait() })

return
return adminService, adminPod, n
}

func TestKongAdminAPIController(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/dataplane/configfetcher/config_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"github.com/kong/deck/dump"
"github.com/kong/deck/utils"
"github.com/kong/go-kong/kong"
"github.com/sirupsen/logrus"

"github.com/kong/kubernetes-ingress-controller/v2/internal/adminapi"
"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/kongstate"
"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/sendconfig"
"github.com/sirupsen/logrus"
)

type LastValidConfigFetcher interface {
Expand Down
7 changes: 4 additions & 3 deletions internal/dataplane/sendconfig/config_change_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (

"github.com/kong/deck/file"
"github.com/kong/go-kong/kong"
"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/deckgen"
"github.com/sirupsen/logrus"

"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/deckgen"
)

const (
Expand Down Expand Up @@ -67,7 +68,7 @@ func (d *DefaultConfigurationChangeDetector) HasConfigurationChanged(
}

// Check if a Kong instance has no configuration yet (could mean it crashed, was rebooted, etc.).
hasNoConfiguration, err := kongHasNoConfiguration(ctx, statusClient, d.log)
hasNoConfiguration, err := kongHasNoConfiguration(ctx, statusClient)
if err != nil {
return false, fmt.Errorf("failed to verify kong readiness: %w", err)
}
Expand All @@ -89,7 +90,7 @@ func (d *DefaultConfigurationChangeDetector) HasConfigurationChanged(
// If the config hash reported by Kong is the known empty hash, it's considered crashed.
// This allows providing configuration to Kong instances that have unexpectedly crashed and
// lost their configuration.
func kongHasNoConfiguration(ctx context.Context, client StatusClient, log logrus.FieldLogger) (bool, error) {
func kongHasNoConfiguration(ctx context.Context, client StatusClient) (bool, error) {
status, err := client.Status(ctx)
if err != nil {
return false, err
Expand Down
6 changes: 3 additions & 3 deletions internal/dataplane/sendconfig/inmemory_error_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ type ConfigError struct {
}

// ConfigErrorFields is the structure under the "fields" key in a /config error response.
type ConfigErrorFields struct {
}
type ConfigErrorFields struct{}

// FlatEntityError represents a single Kong entity with one or more invalid fields.
type FlatEntityError struct {
Expand Down Expand Up @@ -70,7 +69,8 @@ func parseFlatEntityErrors(body []byte, log logrus.FieldLogger) ([]ResourceError
if len(p.Message) > 0 && len(p.Messages) > 0 {
log.WithFields(logrus.Fields{
"name": ee.Name,
"field": p.Field}).Error("entity has both single and array errors for field")
"field": p.Field,
}).Error("entity has both single and array errors for field")

continue
}
Expand Down
4 changes: 2 additions & 2 deletions internal/dataplane/sendconfig/sendconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/kong/go-kong/kong"
"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
k8stypes "k8s.io/apimachinery/pkg/types"

"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/deckgen"
"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/failures"
Expand Down Expand Up @@ -124,7 +124,7 @@ func resourceErrorsToResourceFailures(resourceErrors []ResourceError, parseErr e
ObjectMeta: metav1.ObjectMeta{
Namespace: ee.Namespace,
Name: ee.Name,
UID: types.UID(ee.UID),
UID: k8stypes.UID(ee.UID),
},
}
for field, problem := range ee.Problems {
Expand Down
1 change: 0 additions & 1 deletion internal/manager/utils/kongconfig/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestValidateRoots(t *testing.T) {
assert.Equal(t, tc.expectedKongVersion, kongOptions.Version.String())
})
}

}

const dblessConfigJSON3_1_1 = `{
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/configuration/v1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
// * "Pending".
//
ConditionProgrammed ConditionType = "Programmed"

Expand Down

0 comments on commit 7e567cc

Please sign in to comment.