chore(deps): bump github.com/crazy-max/gohealthchecks

Bumps [github.com/crazy-max/gohealthchecks](https://github.com/crazy-max/gohealthchecks) from 0.4.1 to 0.5.0.
- [Release notes](https://github.com/crazy-max/gohealthchecks/releases)
- [Commits](https://github.com/crazy-max/gohealthchecks/compare/v0.4.1...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/crazy-max/gohealthchecks
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-12-23 07:25:06 +00:00
committed by GitHub
parent d429dfeeec
commit a12e347d9b
13 changed files with 182 additions and 62 deletions

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
Copyright (c) 2020-2023 CrazyMax
Copyright (c) 2020-2024 CrazyMax
Permission is hereby granted, free of charge, to any person obtaining a copy
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.
//
// Get started:
// func main() {
// var err error
// client := gohealthchecks.NewClient(nil)
//
// err = client.Start(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job started!",
// })
// if err != nil {
// log.Fatal(err)
// }
// func main() {
// var err error
// client := gohealthchecks.NewClient(nil)
//
// err = client.Success(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job completed!",
// })
// if err != nil {
// log.Fatal(err)
// }
// err = client.Start(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job started!",
// })
// if err != nil {
// 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)
// }
// }
// err = client.Success(context.Background(), gohealthchecks.PingingOptions{
// UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
// Logs: "Job completed!",
// })
// if err != nil {
// 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

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