diff --git a/README.md b/README.md index 733cd69..b1966e2 100644 --- a/README.md +++ b/README.md @@ -32,16 +32,16 @@ import ( "net/http" "time" - "github.com/hellofresh/health-go/v4" - healthMysql "github.com/hellofresh/health-go/v4/checks/mysql" + "github.com/hellofresh/health-go/v5" + healthMysql "github.com/hellofresh/health-go/v5/checks/mysql" ) func main() { // add some checks on instance creation h, _ := health.New(health.WithComponent(health.Component{ - Name: "myservice", - Version: "v1.0", - }), health.WithChecks(health.Config{ + Name: "myservice", + Version: "v1.0", + }), health.WithChecks(health.Config{ Name: "rabbitmq", Timeout: time.Second * 5, SkipOnErr: true, @@ -82,16 +82,16 @@ import ( "time" "github.com/go-chi/chi" - "github.com/hellofresh/health-go/v4" - healthMysql "github.com/hellofresh/health-go/v4/checks/mysql" + "github.com/hellofresh/health-go/v5" + healthMysql "github.com/hellofresh/health-go/v5/checks/mysql" ) func main() { // add some checks on instance creation h, _ := health.New(health.WithComponent(health.Component{ - Name: "myservice", - Version: "v1.0", - }), health.WithChecks(health.Config{ + Name: "myservice", + Version: "v1.0", + }), health.WithChecks(health.Config{ Name: "rabbitmq", Timeout: time.Second * 5, SkipOnErr: true, diff --git a/_examples/server.go b/_examples/server.go index b30a19f..12cf85b 100644 --- a/_examples/server.go +++ b/_examples/server.go @@ -6,10 +6,10 @@ import ( "net/http" "time" - "github.com/hellofresh/health-go/v4" - healthHttp "github.com/hellofresh/health-go/v4/checks/http" - healthMySql "github.com/hellofresh/health-go/v4/checks/mysql" - healthPg "github.com/hellofresh/health-go/v4/checks/postgres" + "github.com/hellofresh/health-go/v5" + healthHttp "github.com/hellofresh/health-go/v5/checks/http" + healthMySql "github.com/hellofresh/health-go/v5/checks/mysql" + healthPg "github.com/hellofresh/health-go/v5/checks/postgres" ) func main() { diff --git a/checks/rabbitmq/aliveness_check_test.go b/checks/rabbitmq/aliveness_check_test.go index 1c2dbf9..0901047 100644 --- a/checks/rabbitmq/aliveness_check_test.go +++ b/checks/rabbitmq/aliveness_check_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/hellofresh/health-go/v4/checks/http" + "github.com/hellofresh/health-go/v5/checks/http" ) const httpURLEnv = "HEALTH_GO_MQ_URL" diff --git a/docs/index.md b/docs/index.md index 526aa27..184b915 100644 --- a/docs/index.md +++ b/docs/index.md @@ -30,8 +30,8 @@ import ( "net/http" "time" - "github.com/hellofresh/health-go/v4" - healthMysql "github.com/hellofresh/health-go/v4/checks/mysql" + "github.com/hellofresh/health-go/v5" + healthMysql "github.com/hellofresh/health-go/v5/checks/mysql" ) func main() { @@ -77,8 +77,8 @@ import ( "time" "github.com/go-chi/chi" - "github.com/hellofresh/health-go/v4" - healthMysql "github.com/hellofresh/health-go/v4/checks/mysql" + "github.com/hellofresh/health-go/v5" + healthMysql "github.com/hellofresh/health-go/v5/checks/mysql" ) func main() { diff --git a/go.mod b/go.mod index 1735cd9..d28bd49 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/hellofresh/health-go/v4 +module github.com/hellofresh/health-go/v5 go 1.18 diff --git a/health.go b/health.go index b774e19..791dc67 100644 --- a/health.go +++ b/health.go @@ -194,18 +194,10 @@ func (h *Health) Measure(ctx context.Context) Check { }() resCh := make(chan error) - defer close(resCh) go func() { - res := c.Check(ctx) - - select { - case <-resCh: - // channel is already closed - return - default: - resCh <- res - } + resCh <- c.Check(ctx) + defer close(resCh) }() select {