Gofmt the codebase.

This commit is contained in:
2025-02-26 00:47:41 +00:00
parent 66c8fef24d
commit 1b7890f322
20 changed files with 349 additions and 348 deletions
+3 -3
View File
@@ -17,8 +17,8 @@ const CompressionThreshold = 1024 // 1KB
const MaxCacheSize = 10000 const MaxCacheSize = 10000
type CacheEntry struct { type CacheEntry struct {
ExpiresAt time.Time ExpiresAt time.Time
Value []byte Value []byte
Compressed bool Compressed bool
} }
@@ -203,7 +203,7 @@ func (c *Cache) CleanExpiredEntries() {
// evictOldest removes the oldest n entries from the cache // evictOldest removes the oldest n entries from the cache
func (c *Cache) evictOldest(n int) { func (c *Cache) evictOldest(n int) {
type keyExpiry struct { type keyExpiry struct {
key string key string
expiresAt time.Time expiresAt time.Time
} }
+4 -4
View File
@@ -21,10 +21,10 @@ import (
) )
var ( var (
cfg *config cfg *config
cfgMutex sync.RWMutex cfgMutex sync.RWMutex
once sync.Once once sync.Once
tracer *libpack_tracing.TracingSetup tracer *libpack_tracing.TracingSetup
) )
// getDetailsFromEnv retrieves the value from the environment or returns the default. // getDetailsFromEnv retrieves the value from the environment or returns the default.
+2 -1
View File
@@ -157,7 +157,7 @@ func extractUserInfo(c *fiber.Ctx) (string, string) {
// Extract from JWT if available // Extract from JWT if available
if authorization := c.Get("Authorization"); authorization != "" && if authorization := c.Get("Authorization"); authorization != "" &&
(len(cfg.Client.JWTUserClaimPath) > 0 || len(cfg.Client.JWTRoleClaimPath) > 0) { (len(cfg.Client.JWTUserClaimPath) > 0 || len(cfg.Client.JWTRoleClaimPath) > 0) {
extractedUserID, extractedRoleName = extractClaimsFromJWTHeader(authorization) extractedUserID, extractedRoleName = extractClaimsFromJWTHeader(authorization)
} }
@@ -217,6 +217,7 @@ func handleCaching(c *fiber.Ctx, parsedResult *parseGraphQLQueryResult, userID s
return false, nil return false, nil
} }
// proxyAndCacheTheRequest proxies and caches the request if needed. // proxyAndCacheTheRequest proxies and caches the request if needed.
func proxyAndCacheTheRequest(c *fiber.Ctx, queryCacheHash string, cacheTime int, currentEndpoint string) error { func proxyAndCacheTheRequest(c *fiber.Ctx, queryCacheHash string, cacheTime int, currentEndpoint string) error {
if err := proxyTheRequest(c, currentEndpoint); err != nil { if err := proxyTheRequest(c, currentEndpoint); err != nil {
+2 -2
View File
@@ -68,8 +68,8 @@ func NewTracing(ctx context.Context, endpoint string) (*TracingSetup, error) {
semconv.DeploymentEnvironment("production"), semconv.DeploymentEnvironment("production"),
attribute.String("application.type", "proxy"), attribute.String("application.type", "proxy"),
), ),
resource.WithHost(), // Add host information resource.WithHost(), // Add host information
resource.WithOSType(), // Add OS information resource.WithOSType(), // Add OS information
resource.WithProcessPID(), // Add process information resource.WithProcessPID(), // Add process information
) )
if err != nil { if err != nil {