Package meta

import "funnyhaha.technology/httpkit/meta"
View the source code

Overview

Package meta serves what a running API knows about itself: its name, and the version and build of its binary.

Index

Functions

Handler source

func Handler(name string) http.Handler

Handler returns a handler that responds with the running binary's Info as JSON. Mount it at GET /meta.

Types

Info source

type Info struct {
	// Name is the service's name.
	Name string `json:"name"`
	// Version is the main module's version, or "(devel)" for a binary not
	// built by go install at a version.
	Version string `json:"version,omitempty"`
	// Revision is the VCS revision the binary was built from, if known.
	Revision string `json:"revision,omitempty"`
	// Modified reports whether the working tree had uncommitted changes.
	Modified bool `json:"modified,omitempty"`
	// GoVersion is the Go release that built the binary.
	GoVersion string `json:"go_version,omitempty"`
}

Info is the body of a meta response.

Read source

func Read(name string) Info

Read returns the Info for the running binary, from its build information.