Enable some linters (#3129)

Mostly those that did not require much work.

From #2960

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
qwerty287
2024-01-09 21:35:37 +01:00
committed by GitHub
parent 631b7c2fed
commit 768fd71841
21 changed files with 121 additions and 63 deletions

View File

@@ -271,6 +271,8 @@ func getBackendEngine(backendCtx context.Context, backendName string, addons []s
}
func runWithRetry(context *cli.Context) error {
initHealth()
retryCount := context.Int("connect-retry-count")
retryDelay := context.Duration("connect-retry-delay")
var err error

View File

@@ -31,7 +31,7 @@ import (
// following specification:
// https://github.com/mozilla-services/Dockerflow
func init() {
func initHealth() {
http.HandleFunc("/varz", handleStats)
http.HandleFunc("/healthz", handleHeartbeat)
http.HandleFunc("/version", handleVersion)
@@ -48,10 +48,13 @@ func handleHeartbeat(w http.ResponseWriter, _ *http.Request) {
func handleVersion(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200)
w.Header().Add("Content-Type", "text/json")
_ = json.NewEncoder(w).Encode(versionResp{
err := json.NewEncoder(w).Encode(versionResp{
Source: "https://github.com/woodpecker-ci/woodpecker",
Version: version.String(),
})
if err != nil {
log.Error().Err(err).Msg("handleVersion")
}
}
func handleStats(w http.ResponseWriter, _ *http.Request) {