Repository navigation
Expand file tree
/
Copy pathversion.go
More file actions
42 lines (39 loc) · 1.63 KB
/
Copy pathversion.go
File metadata and controls
42 lines (39 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package jsonstat
// Version is the semantic version of the jsonstat-go library.
//
// It is a var rather than a const so that release builds can inject the real
// version from VCS at link time, for example:
//
// go build -ldflags '-X github.com/jsonstat/go.Version=v0.1.1' ./cmd/jsonstat
//
// or, equivalently, via git:
//
// go build -ldflags "-X github.com/jsonstat/go.Version=$(git describe --tags --always --dirty)" ./cmd/jsonstat
//
// When no -ldflags override is supplied, the default below is used. The CLI's
// Makefile `install-cli` target injects the version automatically when a git
// working tree is present; see the "Status" section of API.md.
//
// Note that Go modules do not expose build/debug.ReadBuildInfo() version
// metadata for the main module itself (only for dependencies), so a compile-time
// value is required for runtime introspection of the library version.
var Version = "0.1.1"
// FormatVersion is the JSON-stat format version implemented by this library.
//
// jsonstat-go targets JSON-stat 2.0, matching the rest of the modern
// ecosystem (toolkit, php, io, validator, wasm). Pre-2.0 bundle documents are
// tolerated on decode (see Decode) but never produced on encode.
const FormatVersion = "2.0"
// VersionInfo returns build metadata about the library and the JSON-stat
// format version it implements. It is intended for diagnostics, /version
// endpoints, and CLI banners.
func VersionInfo() map[string]string {
return map[string]string{
"library": "jsonstat-go",
"version": Version,
"jsonstat": FormatVersion,
"go": "1.23",
"spec": "https://json-stat.org/format/",
"license": "Apache-2.0",
}
}