# buildinfo

```go
import "apistock.dev/buildinfo"
```

Package buildinfo reports the version, commit and build time of the running binary, from Go build information or a version set at link time.

Set an explicit version when building:

	go build -ldflags "-X apistock.dev/buildinfo.version=v1.2.3" ./cmd/api

Stability: pre-1.0 (ADR-0015).

## Functions

### func Handler

```go
func Handler() http.Handler
```

Handler serves [Read](#Read) as JSON.

## Types

### type Info

```go
type Info struct {
	Version   string `json:"version" example:"v1.2.3"`
	Commit    string `json:"commit,omitempty" example:"3f9a1c2b7d4e"`
	BuildTime string `json:"build_time,omitempty" example:"2026-09-14T12:00:00Z"`
	Modified  bool   `json:"modified,omitempty"`
	GoVersion string `json:"go_version" example:"go1.25.3"`
}
```

Info describes the running binary.

#### func Read

```go
func Read() Info
```

Read returns information about the running binary. Version is "dev" when neither a link-time version nor a module version is available.

