Skip to content

Commit 0e471e9

Browse files
committed
chore: lint issues
1 parent 0a2160a commit 0e471e9

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

internal/controller/clustertoken_controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ type ClusterTokenReconciler struct {
5555
// For more details, check Reconcile and its Result here:
5656
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
5757
func (r *ClusterTokenReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
58-
log := log.FromContext(ctx)
58+
logger := log.FromContext(ctx)
5959

6060
if app == nil {
6161
app, err = ghapp.NewGHApp(ctx)
6262
if err != nil {
63-
log.Error(err, "failed to load GitHub App credentials")
63+
logger.Error(err, "failed to load GitHub App credentials")
6464
return ctrl.Result{RequeueAfter: time.Minute}, err
6565
}
6666
}
@@ -70,26 +70,26 @@ func (r *ClusterTokenReconciler) Reconcile(ctx context.Context, req ctrl.Request
7070
options := []tm.Option{
7171
tm.WithReconciler(r),
7272
tm.WithGHApp(app),
73-
tm.WithLogger(log),
73+
tm.WithLogger(logger),
7474
}
7575

7676
tokenSecret, err := tm.NewTokenSecret(ctx, req.NamespacedName, token, options...)
7777
if err != nil {
78-
log.Error(err, "failed to create ClusterToken reconciler")
78+
logger.Error(err, "failed to create ClusterToken reconciler")
7979
return ctrl.Result{}, err
8080
}
8181

8282
if tokenSecret == nil {
83-
log.Info("ClusterToken not found, skipping reconciliation")
83+
logger.Info("ClusterToken not found, skipping reconciliation")
8484
return ctrl.Result{}, nil
8585
}
8686

8787
result, err = tokenSecret.Reconcile()
8888
if err != nil {
89-
log.Error(err, "failed to reconcile ClusterToken")
89+
logger.Error(err, "failed to reconcile ClusterToken")
9090
return result, err
9191
}
92-
log.Info("reconciled", "requeueAfter", result.RequeueAfter)
92+
logger.Info("reconciled", "requeueAfter", result.RequeueAfter)
9393
return result, nil
9494
}
9595

internal/controller/token_controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ type TokenReconciler struct {
5555
// For more details, check Reconcile and its Result here:
5656
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
5757
func (r *TokenReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
58-
log := log.FromContext(ctx)
58+
logger := log.FromContext(ctx)
5959

6060
if app == nil {
6161
app, err = ghapp.NewGHApp(ctx)
6262
if err != nil {
63-
log.Error(err, "failed to load GitHub App credentials")
63+
logger.Error(err, "failed to load GitHub App credentials")
6464
return ctrl.Result{RequeueAfter: time.Minute}, err
6565
}
6666
}
@@ -69,26 +69,26 @@ func (r *TokenReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resu
6969
options := []tm.Option{
7070
tm.WithReconciler(r),
7171
tm.WithGHApp(app),
72-
tm.WithLogger(log),
72+
tm.WithLogger(logger),
7373
}
7474

7575
tokenSecret, err := tm.NewTokenSecret(ctx, req.NamespacedName, token, options...)
7676
if err != nil {
77-
log.Error(err, "failed to create Token reconciler")
77+
logger.Error(err, "failed to create Token reconciler")
7878
return ctrl.Result{}, err
7979
}
8080

8181
if tokenSecret == nil {
82-
log.Info("Token not found, skipping reconciliation")
82+
logger.Info("Token not found, skipping reconciliation")
8383
return ctrl.Result{}, nil
8484
}
8585

8686
result, err = tokenSecret.Reconcile()
8787
if err != nil {
88-
log.Error(err, "failed to reconcile Token")
88+
logger.Error(err, "failed to reconcile Token")
8989
return result, err
9090
}
91-
log.Info("reconciled", "requeueAfter", result.RequeueAfter)
91+
logger.Info("reconciled", "requeueAfter", result.RequeueAfter)
9292
return result, nil
9393
}
9494

internal/ghapp/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (c *OperatorConfig) GetKey() string {
4141
const TokenValidity = time.Hour
4242

4343
func LoadConfig(ctx context.Context) (*OperatorConfig, error) {
44-
log := log.FromContext(ctx)
44+
logger := log.FromContext(ctx)
4545

4646
viper.AutomaticEnv()
4747
viper.SetEnvPrefix("GTM")
@@ -60,7 +60,7 @@ func LoadConfig(ctx context.Context) (*OperatorConfig, error) {
6060
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
6161
return nil, fmt.Errorf("error reading configuration file: %w", err)
6262
} else {
63-
log.Info("no configuration file found, continuing with environment variables only")
63+
logger.Info("no configuration file found, continuing with environment variables only")
6464
}
6565
}
6666

internal/ghapp/ghapp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import (
99
)
1010

1111
func NewGHApp(ctx context.Context) (ghait.GHAIT, error) {
12-
log := log.FromContext(ctx)
12+
logger := log.FromContext(ctx)
1313

1414
cfg, err := LoadConfig(ctx)
1515
if err != nil {
1616
return nil, fmt.Errorf("configuration: %w", err)
1717
}
1818

19-
log.Info("loaded configuration", "config", cfg)
19+
logger.Info("loaded configuration", "config", cfg)
2020

2121
ghapp, err := ghait.NewGHAIT(ctx, cfg)
2222
if err != nil {

internal/tokenmanager/token_secret.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ func WithReconciler(reconciler tokenReconciler) Option {
4343
}
4444
}
4545

46-
func WithGHApp(ghait ghait.GHAIT) Option {
46+
func WithGHApp(g ghait.GHAIT) Option {
4747
return func(s *tokenSecret) {
48-
s.ghait = ghait
48+
s.ghait = g
4949
}
5050
}
5151

0 commit comments

Comments
 (0)