Merge pull request #1319 from crazy-max/dependabot/go_modules/github.com/crazy-max/gohealthchecks-0.5.0

chore(deps): bump github.com/crazy-max/gohealthchecks from 0.4.1 to 0.5.0
This commit is contained in:
CrazyMax
2024-12-23 08:32:02 +01:00
committed by GitHub
13 changed files with 182 additions and 62 deletions

2
go.mod
View File

@@ -11,7 +11,7 @@ require (
github.com/containerd/platforms v0.2.1 github.com/containerd/platforms v0.2.1
github.com/containers/image/v5 v5.33.0 github.com/containers/image/v5 v5.33.0
github.com/crazy-max/cron/v3 v3.1.1 github.com/crazy-max/cron/v3 v3.1.1
github.com/crazy-max/gohealthchecks v0.4.1 github.com/crazy-max/gohealthchecks v0.5.0
github.com/crazy-max/gonfig v0.7.1 github.com/crazy-max/gonfig v0.7.1
github.com/distribution/reference v0.6.0 github.com/distribution/reference v0.6.0
github.com/docker/docker v27.3.1+incompatible github.com/docker/docker v27.3.1+incompatible

4
go.sum
View File

@@ -64,8 +64,8 @@ github.com/containers/storage v1.56.0/go.mod h1:c6WKowcAlED/DkWGNuL9bvGYqIWCVy7i
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/crazy-max/cron/v3 v3.1.1 h1:8tsAXjV522daYSaN6/Mb/Nh8X/Ez+nedU0KuPV98rNU= github.com/crazy-max/cron/v3 v3.1.1 h1:8tsAXjV522daYSaN6/Mb/Nh8X/Ez+nedU0KuPV98rNU=
github.com/crazy-max/cron/v3 v3.1.1/go.mod h1:yexi3kKoh3GcnmRCppyJKsvYIBWzDVaym0dwNWo+zdg= github.com/crazy-max/cron/v3 v3.1.1/go.mod h1:yexi3kKoh3GcnmRCppyJKsvYIBWzDVaym0dwNWo+zdg=
github.com/crazy-max/gohealthchecks v0.4.1 h1:gbjZzF/GxwDyP78u37B2/c2iQfq8BEjAHS3eBLM6FcQ= github.com/crazy-max/gohealthchecks v0.5.0 h1:wfkN1QIKTEUkEyqksam5Rbowh/ZwCR/knsgnanJiqg0=
github.com/crazy-max/gohealthchecks v0.4.1/go.mod h1:gkT8QSdEXZJahyswdTGDbd+q20fWm0DmWW7TWBNtgJg= github.com/crazy-max/gohealthchecks v0.5.0/go.mod h1:gkT8QSdEXZJahyswdTGDbd+q20fWm0DmWW7TWBNtgJg=
github.com/crazy-max/gonfig v0.7.1 h1:cT+Wj7syVnsxmjl+u+Fs/cwZEcorHdGdHgcp3UZNWDE= github.com/crazy-max/gonfig v0.7.1 h1:cT+Wj7syVnsxmjl+u+Fs/cwZEcorHdGdHgcp3UZNWDE=
github.com/crazy-max/gonfig v0.7.1/go.mod h1:csPFrGh/m0nIamCJbah1ZN2/+5s510nQQ7szHsk8HZ0= github.com/crazy-max/gonfig v0.7.1/go.mod h1:csPFrGh/m0nIamCJbah1ZN2/+5s510nQQ7szHsk8HZ0=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=

View File

@@ -0,0 +1 @@
/bin

View File

@@ -1 +1 @@
/coverage.txt /bin

View File

@@ -0,0 +1,82 @@
run:
timeout: 10m
# default uses Go version from the go.mod file, fallback on the env var
# `GOVERSION`, fallback on 1.17: https://golangci-lint.run/usage/configuration/#run-configuration
go: "1.23"
linters:
enable:
- bodyclose
- depguard
- forbidigo
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- makezero
- misspell
- noctx
- nolintlint
- revive
- staticcheck
- testifylint
- typecheck
- unused
- whitespace
disable-all: true
linters-settings:
gocritic:
disabled-checks:
- "ifElseChain"
- "assignOp"
- "appendAssign"
- "singleCaseSwitch"
govet:
enable:
- nilness
- unusedwrite
depguard:
rules:
main:
deny:
- pkg: "io/ioutil"
desc: The io/ioutil package has been deprecated.
gosec:
config:
G306: "0644"
testifylint:
disable:
# disable rules that reduce the test condition
- "empty"
- "bool-compare"
- "len"
- "negative-positive"
issues:
exclude-rules:
- linters:
- revive
text: "stutters"
- linters:
- revive
text: "empty-block"
- linters:
- revive
text: "superfluous-else"
- linters:
- revive
text: "unused-parameter"
- linters:
- revive
text: "redefines-builtin-id"
- linters:
- revive
text: "if-return"
# show all
max-issues-per-linter: 0
max-same-issues: 0

View File

@@ -1,26 +0,0 @@
# Changelog
## 0.4.1 (2023/05/05)
* Missing version bump
## 0.4.0 (2023/05/05)
* Go 1.20 support (#7 #15 #19)
* Use `POST` method (#18)
## 0.3.0 (2021/03/08)
* Go 1.16 support
## 0.2.0 (2020/10/13)
* Allow logs for start event
## 0.1.1 (2020/10/13)
* Fix requests path
## 0.1.0 (2020/10/12)
* Initial version

31
vendor/github.com/crazy-max/gohealthchecks/Dockerfile generated vendored Normal file
View File

@@ -0,0 +1,31 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION="1.23"
ARG GOLANGCI_LINT_VERSION="v1.62"
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM golang:${GO_VERSION}-alpine AS base
ENV GOFLAGS="-buildvcs=false"
RUN apk add --no-cache gcc linux-headers musl-dev
WORKDIR /src
FROM base AS test
ARG GO_VERSION
ENV CGO_ENABLED=1
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build <<EOT
set -ex
go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic -race ./...
go tool cover -func=/tmp/coverage.txt
EOT
FROM scratch AS test-coverage
COPY --from=test /tmp/coverage*.txt /
FROM base AS lint
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
golangci-lint run ./...

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020-2023 CrazyMax Copyright (c) 2020-2024 CrazyMax
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -0,0 +1,8 @@
comment: false
coverage:
status:
patch: false
github_checks:
annotations: false

View File

@@ -1,32 +1,33 @@
// Go client library for accessing the Healthchecks API. // Go client library for accessing the Healthchecks API.
// //
// Get started: // Get started:
// func main() {
// var err error
// client := gohealthchecks.NewClient(nil)
// //
// err = client.Start(context.Background(), gohealthchecks.PingingOptions{ // func main() {
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278", // var err error
// Logs: "Job started!", // client := gohealthchecks.NewClient(nil)
// })
// if err != nil {
// log.Fatal(err)
// }
// //
// err = client.Success(context.Background(), gohealthchecks.PingingOptions{ // err = client.Start(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278", // UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job completed!", // Logs: "Job started!",
// }) // })
// if err != nil { // if err != nil {
// log.Fatal(err) // log.Fatal(err)
// } // }
// //
// err = client.Fail(context.Background(), gohealthchecks.PingingOptions{ // err = client.Success(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278", // UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job failed...", // Logs: "Job completed!",
// }) // })
// if err != nil { // if err != nil {
// log.Fatal(err) // log.Fatal(err)
// } // }
// } //
// err = client.Fail(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job failed...",
// })
// if err != nil {
// log.Fatal(err)
// }
// }
package gohealthchecks package gohealthchecks

View File

@@ -0,0 +1,24 @@
variable "GO_VERSION" {
default = null
}
variable "DESTDIR" {
default = "./bin"
}
group "default" {
targets = ["test"]
}
target "test" {
target = "test-coverage"
output = ["${DESTDIR}/coverage"]
args = {
GO_VERSION = GO_VERSION
}
}
target "lint" {
target = "lint"
output = ["type=cacheonly"]
}

View File

@@ -5,7 +5,6 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"runtime" "runtime"
@@ -14,7 +13,7 @@ import (
) )
const ( const (
version = "0.4.1" version = "0.5.0"
defaultBaseURL = "https://hc-ping.com/" defaultBaseURL = "https://hc-ping.com/"
) )
@@ -82,6 +81,7 @@ func (c *Client) request(ctx context.Context, method, path string, body []byte)
if err != nil { if err != nil {
return err return err
} }
defer r.Body.Close()
defer drain(r.Body) defer drain(r.Body)
if r.StatusCode != 200 { if r.StatusCode != 200 {
@@ -95,13 +95,12 @@ func (c *Client) request(ctx context.Context, method, path string, body []byte)
// asynchronously. // asynchronously.
func drain(r io.ReadCloser) { func drain(r io.ReadCloser) {
go func() { go func() {
// Panicking here does not put data in // panicking here does not put data in an inconsistent state.
// an inconsistent state.
defer func() { defer func() {
_ = recover() _ = recover()
}() }()
_, _ = io.Copy(ioutil.Discard, r) _, _ = io.Copy(io.Discard, r)
r.Close() r.Close()
}() }()
} }

2
vendor/modules.txt vendored
View File

@@ -117,7 +117,7 @@ github.com/containers/storage/pkg/unshare
# github.com/crazy-max/cron/v3 v3.1.1 # github.com/crazy-max/cron/v3 v3.1.1
## explicit; go 1.12 ## explicit; go 1.12
github.com/crazy-max/cron/v3 github.com/crazy-max/cron/v3
# github.com/crazy-max/gohealthchecks v0.4.1 # github.com/crazy-max/gohealthchecks v0.5.0
## explicit; go 1.13 ## explicit; go 1.13
github.com/crazy-max/gohealthchecks github.com/crazy-max/gohealthchecks
# github.com/crazy-max/gonfig v0.7.1 # github.com/crazy-max/gonfig v0.7.1