Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea4aa7d

Browse files
committed
linting
1 parent67644cc commitea4aa7d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

‎coderd/dynamicparameters/render.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Renderer interface {
3131
Close()
3232
}
3333

34-
varErrorTemplateVersionNotReady=xerrors.New("template version job not finished")
34+
varErrTemplateVersionNotReady=xerrors.New("template version job not finished")
3535

3636
// Loader is used to load the necessary coder objects for rendering a template
3737
// version's parameters. The output is a Renderer, which is the object that uses
@@ -91,7 +91,7 @@ func (r *Loader) Load(ctx context.Context, db database.Store) error {
9191
}
9292

9393
if!r.job.CompletedAt.Valid {
94-
returnErrorTemplateVersionNotReady
94+
returnErrTemplateVersionNotReady
9595
}
9696

9797
ifr.terraformValues==nil {
@@ -131,7 +131,9 @@ func (r *Loader) Renderer(ctx context.Context, db database.Store, cache *files.C
131131
// Renderer caches all the necessary files when rendering a template version's
132132
// parameters. It must be closed after use to release the cached files.
133133
func (r*Loader)dynamicRenderer(ctx context.Context,db database.Store,cache*files.Cache) (*DynamicRenderer,error) {
134-
// If they can read the template version, then they can read the file.
134+
// If they can read the template version, then they can read the file for
135+
// parameter loading purposes.
136+
//nolint:gocritic
135137
fileCtx:=dbauthz.AsFileReader(ctx)
136138
templateFS,err:=cache.Acquire(fileCtx,r.job.FileID)
137139
iferr!=nil {
@@ -174,9 +176,8 @@ type DynamicRenderer struct {
174176
templateFS fs.FS
175177
plan json.RawMessage
176178

177-
ownerErrorsmap[uuid.UUID]error
178-
currentOwner*previewtypes.WorkspaceOwner
179-
currentOwnerID uuid.UUID
179+
ownerErrorsmap[uuid.UUID]error
180+
currentOwner*previewtypes.WorkspaceOwner
180181

181182
once sync.Once
182183
closefunc()

‎coderd/dynamicparameters/static.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ func (r *StaticRender) Render(_ context.Context, _ uuid.UUID, values map[string]
131131
}
132132
}
133133

134-
func (r*StaticRender)Close() {}
134+
func (*StaticRender)Close() {}

‎coderd/parameters.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func (api *API) templateVersionDynamicParametersWebsocket(rw http.ResponseWriter
6868
})(rw,r)
6969
}
7070

71+
//nolint:revive // listen is a control flag
7172
func (api*API)templateVersionDynamicParameters(listenbool,initial codersdk.DynamicParametersRequest)func(rw http.ResponseWriter,r*http.Request) {
7273
returnfunc(rw http.ResponseWriter,r*http.Request) {
7374
ctx:=r.Context()
@@ -78,16 +79,16 @@ func (api *API) templateVersionDynamicParameters(listen bool, initial codersdk.D
7879

7980
err:=loader.Load(ctx,api.Database)
8081
iferr!=nil {
81-
8282
ifhttpapi.Is404Error(err) {
8383
httpapi.ResourceNotFound(rw)
8484
return
8585
}
8686

87-
ifxerrors.Is(err,dynamicparameters.ErrorTemplateVersionNotReady) {
87+
ifxerrors.Is(err,dynamicparameters.ErrTemplateVersionNotReady) {
8888
httpapi.Write(ctx,rw,http.StatusTooEarly, codersdk.Response{
8989
Message:"Template version job has not finished",
9090
})
91+
return
9192
}
9293

9394
httpapi.Write(ctx,rw,http.StatusInternalServerError, codersdk.Response{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp