Skip to content

Commit f3a5841

Browse files
committed
Fix all lint issues: struct field alignment and import formatting
- Use fieldalignment tool to optimize struct memory layout - Apply gci import formatting to all files - All golangci-lint checks now pass
1 parent 69fe1f4 commit f3a5841

File tree

6 files changed

+38
-41
lines changed

6 files changed

+38
-41
lines changed

cmd/migrate/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"fmt"
77
"log"
88

9-
"github.com/EvalOps/keep/pkg/secrets"
109
"github.com/golang-migrate/migrate/v4"
1110
_ "github.com/golang-migrate/migrate/v4/database/postgres"
1211
_ "github.com/golang-migrate/migrate/v4/source/file"
12+
13+
"github.com/EvalOps/keep/pkg/secrets"
1314
)
1415

1516
func main() {

pkg/vouch/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ var (
4545

4646
// DevicePosture represents device posture information from Vouch
4747
type DevicePosture struct {
48-
Attributes map[string]interface{} `json:"attributes"`
49-
Compliance ComplianceStatus `json:"compliance"`
5048
LastSeen time.Time `json:"last_seen"`
49+
Attributes map[string]interface{} `json:"attributes"`
5150
ID string `json:"id"`
5251
Hostname string `json:"hostname"`
5352
NodeID string `json:"node_id"`
54-
Posture string `json:"posture"` // "healthy", "degraded", "unknown"
55-
TrustScore int `json:"trust_score"` // 0-100
53+
Posture string `json:"posture"`
54+
Compliance ComplianceStatus `json:"compliance"`
55+
TrustScore int `json:"trust_score"`
5656
}
5757

5858
// ComplianceStatus represents device compliance information

services/authz/server/config.go

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@ package server
33
import "time"
44

55
type Config struct {
6-
// time.Duration fields first (8 bytes each)
7-
VouchTimeout time.Duration
8-
VouchCacheTTL time.Duration
9-
DeviceCertHours time.Duration
10-
RequestTimeout time.Duration
11-
RetryMaxElapsed time.Duration
12-
13-
// int fields next (4/8 bytes each)
14-
VouchMaxEntries int
15-
VouchRetryAttempts int
16-
RetryMaxAttempts int
17-
18-
// bool fields (1 byte each)
19-
VouchEnabled bool
20-
VouchRetryEnabled bool
21-
VouchCircuitBreaker bool
22-
TelemetryInsecure bool
23-
24-
// string fields last (pointers - 8 bytes each + variable size)
6+
InventoryClientCert string
7+
InventoryClientKey string
8+
TelemetryEnv string
9+
TelemetryEndpoint string
10+
MFAServiceURL string
11+
TailscaleTailnet string
12+
TailscaleAPIKey string
13+
TailscaleListenAddr string
2514
HTTPAddr string
2615
GRPCAddr string
2716
TLSCertPath string
@@ -30,17 +19,21 @@ type Config struct {
3019
GoogleClientID string
3120
OPAURL string
3221
InventoryAPI string
33-
InventoryClientCert string // Client certificate for mTLS to inventory service
34-
InventoryClientKey string // Client private key for mTLS to inventory service
35-
InventoryCA string // CA certificate for inventory service validation
22+
TailscaleHostname string
23+
InventoryCA string
24+
TailscaleAuthKey string
3625
VouchBaseURL string
3726
VouchAPIKey string
38-
TailscaleAuthKey string
39-
TailscaleHostname string
40-
TailscaleListenAddr string
41-
TailscaleAPIKey string
42-
TailscaleTailnet string
43-
MFAServiceURL string
44-
TelemetryEndpoint string
45-
TelemetryEnv string
27+
VouchTimeout time.Duration
28+
VouchCacheTTL time.Duration
29+
RetryMaxAttempts int
30+
VouchRetryAttempts int
31+
VouchMaxEntries int
32+
RetryMaxElapsed time.Duration
33+
RequestTimeout time.Duration
34+
DeviceCertHours time.Duration
35+
VouchEnabled bool
36+
VouchRetryEnabled bool
37+
VouchCircuitBreaker bool
38+
TelemetryInsecure bool
4639
}

services/authz/server/server.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ import (
1818
"sync"
1919
"time"
2020

21+
"github.com/go-chi/chi/v5"
22+
"github.com/go-chi/chi/v5/middleware"
23+
"github.com/prometheus/client_golang/prometheus/promhttp"
24+
"tailscale.com/tsnet"
25+
2126
"github.com/EvalOps/keep/pkg/logging"
2227
"github.com/EvalOps/keep/pkg/metrics"
2328
"github.com/EvalOps/keep/pkg/pki"
2429
"github.com/EvalOps/keep/pkg/retry"
2530
"github.com/EvalOps/keep/pkg/telemetry"
2631
"github.com/EvalOps/keep/pkg/vouch"
2732
"github.com/EvalOps/keep/services/authz/token"
28-
"github.com/go-chi/chi/v5"
29-
"github.com/go-chi/chi/v5/middleware"
30-
"github.com/prometheus/client_golang/prometheus/promhttp"
31-
"tailscale.com/tsnet"
3233
)
3334

3435
const (

services/authz/server/server_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
"testing"
1212
"time"
1313

14+
"tailscale.com/tsnet"
15+
1416
"github.com/EvalOps/keep/pkg/pki"
1517
"github.com/EvalOps/keep/pkg/retry"
16-
"tailscale.com/tsnet"
1718
)
1819

1920
const (

services/inventory/server/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import (
1313
"os"
1414
"time"
1515

16-
"github.com/EvalOps/keep/pkg/telemetry"
1716
"github.com/go-chi/chi/v5"
1817
"github.com/go-chi/chi/v5/middleware"
1918
_ "github.com/jackc/pgx/v5/stdlib" // register pgx driver with database/sql
19+
20+
"github.com/EvalOps/keep/pkg/telemetry"
2021
)
2122

2223
const (

0 commit comments

Comments
 (0)