gogo

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

README

This software is very much still in progress!

GoGo 🏃‍♂️

Write exported Go functions, run them from anywhere. Simple as that.

Getting Started

Note: Currently this is missing the global function directory and auto-completion functionality. It can be considered stable in that it is a functional tool, however some of the behavior and gogo.Context interface/implementation is still being updated. The documentation is not completely accurate.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BuildTime is the timestamp when the binary was built, injected by -ldflags
	BuildTime string = "..."
	// Who identifies the builder of this binary, injected by -ldflags
	Who string = "..."
	// State indicates whether the build was from a clean working directory, injected by -ldflags
	State string = "..."
	// VersionTag is the semantic version of the application, injected by -ldflags
	VersionTag = "0.1.0"
)

These attributes should only be changed by the build script, do not change it manually.

Functions

func PrintVersion

func PrintVersion(w io.Writer)

PrintVersion prints the build information to the specified writer This is useful for CLI applications where you want to output version info to stdout, stderr, or a log file

func Version

func Version() string

returns the version in the format "[vX.Y.Z:]commit"

Types

type BuildInfo

type BuildInfo struct {

	// BuildSha is the Git commit SHA, injected by -ldflags during build
	BuildSha string
	// BuildTime is the timestamp when the binary was built, injected by -ldflags
	BuildTime string
	// Who identifies the builder of this binary, injected by -ldflags
	Who string
	// State indicates whether the build was from a clean working directory, injected by -ldflags
	State string
	// Version is the semantic version of the application, injected by -ldflags
	Version string

	// GoVersion is the Go version used to build the binary (e.g., "go1.18.3")
	GoVersion string
	// Path is the main module path
	Path string
	// Main contains information about the main module
	Main Module
	// Dependencies contains information about all dependencies
	Dependencies []Module

	// BuildMode indicates how the binary was built (e.g., "exe")
	BuildMode string
	// Compiler indicates which compiler was used (e.g., "gc")
	Compiler string
	// CGOEnabled indicates whether CGO was enabled during build
	CGOEnabled string
	// GOOS is the target operating system (e.g., "darwin", "linux")
	GOOS string
	// GOARCH is the target architecture (e.g., "amd64", "arm64")
	GOARCH string
	// GOARMVersion specifies the ARM version if GOARCH is "arm" or "arm64"
	GOARMVersion string

	// VCS identifies the version control system (e.g., "git")
	VCS string
	// VCSRevision is the full commit hash from version control
	VCSRevision string
	// VCSTime is the commit timestamp from version control
	VCSTime string
	// VCSModified indicates whether the working directory had uncommitted changes
	VCSModified string

	// Raw build settings for any custom or additional settings
	RawSettings []BuildSetting
}

BuildInfo contains comprehensive version and build information from both custom ldflags injection and Go's runtime/debug package.

func GetBuildInfo

func GetBuildInfo() BuildInfo

GetBuildInfo returns comprehensive version information by combining manually injected build variables with Go's runtime build information

func (BuildInfo) PrettyPrint

func (info BuildInfo) PrettyPrint() string

PrettyPrint formats build information in a human-readable way for CLI applications It returns a string containing formatted build information with proper indentation and grouping

type BuildSetting

type BuildSetting struct {
	// Key is the name of the build setting
	Key string
	// Value is the value of the build setting
	Value string
}

BuildSetting represents an individual build setting key-value pair

type Module

type Module struct {
	// Path is the import path of the module
	Path string
	// Version is the module version
	Version string
	// Sum is the checksum of the module
	Sum string
	// Replace points to a replacement if this module is replaced
	Replace *Module
}

Module represents a Go module with its version information

Directories

Path Synopsis
cmd
gogo command
wizard command
pkg
fs
mod
sh
gogo module
scripts/gogo module
scenarios

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL