# waitfor **Repository Path**: mirrors_puppetlabs/waitfor ## Basic Information - **Project Name**: waitfor - **Description**: WaitFor is a simple library for implementing dependency checks in your Go application. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-04-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # waitfor [![Go Report Card](https://goreportcard.com/badge/github.com/davejohnston/waitfor)](https://goreportcard.com/report/github.com/davejohnston/waitfor) [![GoDoc](https://godoc.org/github.com/davejohnston/waitfor?status.svg)](https://godoc.org/github.com/davejohnston/waitfor) WaitFor is a simple library for implementing dependency checks in your Go application. ## Summary Waitfor provides a simple API to wait for your applications dependancies to become available. For example if your application relies on an external database wait for can check that the service is up and listening. This can be useful in container environments where your services DNS name is not registered until the remote service becomes healthy. ## Usage See the [GoDoc examples](https://godoc.org/github.com/davejohnston/waitfor) for more detail. - Install with `go get`: `go get -u github.com/davejohnston/waitfor` - Create a dependancy handler: ```go var dependancies = waitfor.NewDependencies()() ``` - Add a dependancy: ```go dependancies.Add("rest-api", waitfor.ServiceListening("0.0.0.0:9999", 10*time.Second)) dependancies.Add("postgres-db", waitfor.DatabaseReady("postgres", "host=localhost port=5423 user=postgres password=secret dbname=postgres sslmode=disable") ``` - Wait for the dependancies: ```go if err := dependancies.Wait(); err != nil { log.fatal(err) } ```