Documentation
¶
Overview ¶
Package buildinfo provides information about the build.
This implementation was inspired by the go-version module.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
func (Info) String ¶
Example ¶
package main
import (
"fmt"
gobuildinfo "github.com/bartventer/go-buildinfo"
)
const logo = `
_| _| _| _| _| _|_|
_|_|_| _| _| _| _|_|_| _|_|_| _| _|_|
_| _| _| _| _| _| _| _| _| _| _| _|_|_|_| _| _|
_| _| _| _| _| _| _| _| _| _| _| _| _| _|
_|_|_| _|_|_| _| _| _|_|_| _| _| _| _| _|_|
`
func main() {
info := gobuildinfo.New(
gobuildinfo.WithVersion("v1.0.0"),
gobuildinfo.WithCommit("a696fbbcb8ae009e3f88df2d7b00c09bea903c9e"),
gobuildinfo.WithDate("2023-01-01"),
gobuildinfo.WithTreeState("clean"),
gobuildinfo.WithDisableRuntime(), // Comment this line to include runtime info
gobuildinfo.WithProject(gobuildinfo.Project{
Name: "MyApp",
Description: "This is a sample app",
URL: "https://example.com",
ASCIILogo: logo,
}),
)
fmt.Println(info.String())
}
Output: _| _| _| _| _| _|_| _|_|_| _| _| _| _|_|_| _|_|_| _| _|_| _| _| _| _| _| _| _| _| _| _| _| _|_|_|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _| _|_| MyApp: This is a sample app https://example.com Version: v1.0.0 Commit: a696fbbcb8ae009e3f88df2d7b00c09bea903c9e Date: 2023-01-01 TreeState: clean
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithCommit ¶
func WithDisableRuntime ¶ added in v0.2.0
func WithDisableRuntime() Option
func WithProject ¶
func WithTreeState ¶
func WithVersion ¶
Click to show internal directories.
Click to hide internal directories.