Skip to content

Commit 7b5d6ee

Browse files
committed
fix merge conflict with main
2 parents 54833de + b461c37 commit 7b5d6ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+285
-208
lines changed

.golangci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,28 @@ linters:
1818
- bidichk
1919
- bodyclose
2020
- containedctx
21+
- contextcheck
2122
- copyloopvar
2223
- dogsled
2324
- durationcheck
2425
- errname
2526
- errorlint
2627
- exptostd
28+
- gocritic
2729
- govet
30+
- iface
31+
- importas
2832
- staticcheck
2933
- testifylint
3034
- thelper
3135
- tparallel
36+
- usetesting
37+
- wastedassign
38+
- whitespace
3239
settings:
40+
gocritic:
41+
disabled-checks:
42+
- appendAssign
3343
staticcheck:
3444
checks:
3545
- all

packages/api/internal/cache/auth/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (c *TeamAuthCache) GetOrSet(ctx context.Context, key string, dataCallback D
6666

6767
templateInfo = item.Value()
6868
if time.Since(templateInfo.lastRefresh) > refreshInterval {
69-
go templateInfo.once.Do(key, func() (interface{}, error) {
69+
go templateInfo.once.Do(key, func() (interface{}, error) { // nolint:contextcheck // TODO: fix this later
7070
c.Refresh(key, dataCallback)
7171
return nil, err
7272
})

packages/api/internal/cache/instance/instance.go

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -31,57 +31,57 @@ const (
3131
)
3232

3333
func NewInstanceInfo(
34-
SandboxID string,
35-
TemplateID string,
36-
ClientID string,
37-
Alias *string,
38-
ExecutionID string,
39-
TeamID uuid.UUID,
40-
BuildID uuid.UUID,
41-
Metadata map[string]string,
42-
MaxInstanceLength time.Duration,
43-
StartTime time.Time,
34+
sandboxID string,
35+
templateID string,
36+
clientID string,
37+
alias *string,
38+
executionID string,
39+
teamID uuid.UUID,
40+
buildID uuid.UUID,
41+
metadata map[string]string,
42+
maxInstanceLength time.Duration,
43+
startTime time.Time,
4444
endTime time.Time,
45-
VCpu int64,
46-
TotalDiskSizeMB int64,
47-
RamMB int64,
48-
KernelVersion string,
49-
FirecrackerVersion string,
50-
EnvdVersion string,
51-
NodeID string,
52-
ClusterID uuid.UUID,
53-
AutoPause bool,
54-
EnvdAccessToken *string,
45+
vcpu int64,
46+
totalDiskSizeMB int64,
47+
ramMB int64,
48+
kernelVersion string,
49+
firecrackerVersion string,
50+
envdVersion string,
51+
nodeID string,
52+
clusterID uuid.UUID,
53+
autoPause bool,
54+
envdAccessToken *string,
5555
allowInternetAccess *bool,
56-
BaseTemplateID string,
56+
baseTemplateID string,
5757
) *InstanceInfo {
5858
instance := &InstanceInfo{
59-
SandboxID: SandboxID,
60-
TemplateID: TemplateID,
61-
ClientID: ClientID,
62-
Alias: Alias,
63-
64-
ExecutionID: ExecutionID,
65-
TeamID: TeamID,
66-
BuildID: BuildID,
67-
Metadata: Metadata,
68-
MaxInstanceLength: MaxInstanceLength,
69-
StartTime: StartTime,
59+
SandboxID: sandboxID,
60+
TemplateID: templateID,
61+
ClientID: clientID,
62+
Alias: alias,
63+
64+
ExecutionID: executionID,
65+
TeamID: teamID,
66+
BuildID: buildID,
67+
Metadata: metadata,
68+
MaxInstanceLength: maxInstanceLength,
69+
StartTime: startTime,
7070
endTime: endTime,
71-
VCpu: VCpu,
72-
TotalDiskSizeMB: TotalDiskSizeMB,
73-
RamMB: RamMB,
74-
KernelVersion: KernelVersion,
75-
FirecrackerVersion: FirecrackerVersion,
76-
EnvdVersion: EnvdVersion,
77-
EnvdAccessToken: EnvdAccessToken,
71+
VCpu: vcpu,
72+
TotalDiskSizeMB: totalDiskSizeMB,
73+
RamMB: ramMB,
74+
KernelVersion: kernelVersion,
75+
FirecrackerVersion: firecrackerVersion,
76+
EnvdVersion: envdVersion,
77+
EnvdAccessToken: envdAccessToken,
7878
AllowInternetAccess: allowInternetAccess,
79-
NodeID: NodeID,
80-
ClusterID: ClusterID,
81-
AutoPause: AutoPause,
79+
NodeID: nodeID,
80+
ClusterID: clusterID,
81+
AutoPause: autoPause,
8282
state: StateRunning,
8383
stopping: utils.NewSetOnce[struct{}](),
84-
BaseTemplateID: BaseTemplateID,
84+
BaseTemplateID: baseTemplateID,
8585
mu: sync.RWMutex{},
8686
}
8787

packages/api/internal/cache/instance/reservation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestReservation_ResumeAlreadyRunningSandbox(t *testing.T) {
7575
endTime: time.Now().Add(time.Hour),
7676
MaxInstanceLength: time.Hour,
7777
}
78-
err := cache.Add(context.Background(), info, false)
78+
err := cache.Add(t.Context(), info, false)
7979
require.NoError(t, err)
8080

8181
_, err = cache.Reserve(sandboxID, teamID, 1)

packages/api/internal/dns/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (d *DNS) Start(ctx context.Context, address string, port string) {
233233

234234
// Close should be a noop if it's already been called,
235235
// and it caches the error.
236-
_ = d.Close(shutdownCtx)
236+
_ = d.Close(shutdownCtx) // nolint:contextcheck // TODO: fix this later
237237
}()
238238
}
239239

packages/api/internal/edge/pool.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,14 @@ func (d poolSynchronizationStore) PoolInsert(ctx context.Context, cluster querie
161161

162162
zap.L().Info("Initializing newly discovered cluster", l.WithClusterID(cluster.ID))
163163

164-
c, err := NewCluster(d.pool.tel, cluster.Endpoint, cluster.EndpointTls, cluster.Token, cluster.ID, cluster.SandboxProxyDomain)
164+
c, err := NewCluster( // nolint:contextcheck // TODO: fix this later
165+
d.pool.tel,
166+
cluster.Endpoint,
167+
cluster.EndpointTls,
168+
cluster.Token,
169+
cluster.ID,
170+
cluster.SandboxProxyDomain,
171+
)
165172
if err != nil {
166173
zap.L().Error("Initializing cluster failed", zap.Error(err), l.WithClusterID(c.ID))
167174
return

packages/api/internal/handlers/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func NewAPIStore(ctx context.Context, tel *telemetry.Client) *APIStore {
153153

154154
authCache := authcache.NewTeamAuthCache()
155155
templateCache := templatecache.NewTemplateCache(sqlcDB)
156-
templateSpawnCounter := utils.NewTemplateSpawnCounter(time.Minute, dbClient)
156+
templateSpawnCounter := utils.NewTemplateSpawnCounter(time.Minute, dbClient) // nolint:contextcheck // TODO: fix this later
157157

158158
accessTokenGenerator, err := sandbox.NewEnvdAccessTokenGenerator()
159159
if err != nil {

packages/api/internal/handlers/template_request_build.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ func getCPUAndRAM(tier *queries.Tier, cpuCount, memoryMB *int32) (int64, int64,
530530
Code: http.StatusBadRequest,
531531
}
532532
}
533-
534533
}
535534

536535
if memoryMB != nil {

packages/api/internal/metrics/team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (so *TeamObserver) Start(cache *instance.MemoryStore) (err error) {
8787
sbxsPerTeam[teamID] = 0
8888
}
8989

90-
sbxsPerTeam[teamID] = sbxsPerTeam[teamID] + 1
90+
sbxsPerTeam[teamID]++
9191
}
9292

9393
// Reset the max for the new interval to the current counts

packages/api/internal/middleware/otel/metrics/middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Middleware(meterProvider metric.MeterProvider, service string, options ...O
3131
ctx := ginCtx.Request.Context()
3232

3333
route := ginCtx.FullPath()
34-
if len(route) <= 0 {
34+
if len(route) == 0 {
3535
route = "nonconfigured"
3636
}
3737

0 commit comments

Comments
 (0)