Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e494e9a

Browse files
committed
linting
1 parent f0622f6 commit e494e9a

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-
var ErrorTemplateVersionNotReady = xerrors.New("template version job not finished")
34+
var ErrTemplateVersionNotReady = 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-
return ErrorTemplateVersionNotReady
94+
return ErrTemplateVersionNotReady
9595
}
9696

9797
if r.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
if err != nil {
@@ -174,9 +176,8 @@ type DynamicRenderer struct {
174176
templateFS fs.FS
175177
plan json.RawMessage
176178

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

181182
once sync.Once
182183
close func()

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(listen bool, initial codersdk.DynamicParametersRequest) func(rw http.ResponseWriter, r *http.Request) {
7273
return func(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
if err != nil {
81-
8282
if httpapi.Is404Error(err) {
8383
httpapi.ResourceNotFound(rw)
8484
return
8585
}
8686

87-
if xerrors.Is(err, dynamicparameters.ErrorTemplateVersionNotReady) {
87+
if xerrors.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)