Skip to content

Commit ce4039a

Browse files
committed
fixup! add make lint to Makefile
1 parent 528ce6d commit ce4039a

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ site/out:
8989
git checkout HEAD site/out
9090
.PHONY: site/out
9191

92-
lint/go:
92+
lint:
9393
@echo "--- golangci-lint"
9494
golangci-lint run
95-
.PHONY: lint/go
96-
97-
lint: lint/go
9895
.PHONY: lint

coderd/provisionerjobs.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
138138
// See: https://canjs.com/doc/can-ndjson-stream.html
139139
rw.Header().Set("Content-Type", "application/stream+json")
140140
rw.WriteHeader(http.StatusOK)
141-
tryFlush(rw)
141+
if flusher, ok := rw.(http.Flusher); ok {
142+
flusher.Flush()
143+
}
142144

143145
// The Go stdlib JSON encoder appends a newline character after message write.
144146
encoder := json.NewEncoder(rw)
@@ -161,7 +163,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
161163
if err != nil {
162164
return
163165
}
164-
tryFlush(rw)
166+
if flusher, ok := rw.(http.Flusher); ok {
167+
flusher.Flush()
168+
}
165169
case <-ticker.C:
166170
job, err := api.Database.GetProvisionerJobByID(r.Context(), job.ID)
167171
if err != nil {
@@ -175,12 +179,6 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
175179
}
176180
}
177181

178-
func tryFlush(w http.ResponseWriter) {
179-
if flusher, ok := w.(http.Flusher); ok {
180-
flusher.Flush()
181-
}
182-
}
183-
184182
func (api *api) provisionerJobResources(rw http.ResponseWriter, r *http.Request, job database.ProvisionerJob) {
185183
if !job.CompletedAt.Valid {
186184
httpapi.Write(rw, http.StatusPreconditionFailed, httpapi.Response{

0 commit comments

Comments
 (0)