buildflags

package
v3.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package buildflags is the one place the build tags and linker flags of a tt binary are spelled out. The magefile builds tt with them and tt binary build tt builds a distribution of tt with them, so the two cannot drift apart.

Index

Constants

View Source
const Env = "TT_CLI_BUILD_SSL"

Env is the environment variable that selects the TLS implementation tt is built with.

Variables

View Source
var ErrUnsupported = errors.New("unsupported build type")

ErrUnsupported reports a TLS implementation tt cannot be built with.

Functions

This section is empty.

Types

type SSL

type SSL string

SSL is the TLS implementation a tt binary is built with.

const (
	// Default is TLS in pure Go: the binary needs no OpenSSL and no cgo.
	Default SSL = "default"
	// OpenSSL links the OpenSSL of the machine the binary runs on.
	OpenSSL SSL = "openssl"
	// OpenSSLStatic links OpenSSL into the binary, which is static.
	OpenSSLStatic SSL = "openssl_static"
)

The TLS implementations.

func Parse

func Parse(name string) (SSL, error)

Parse returns the TLS implementation named name. The empty name is Default.

func (SSL) Cgo

func (s SSL) Cgo() bool

Cgo reports whether a binary built with s needs cgo.

func (SSL) Ldflags

func (s SSL) Ldflags(goos string) []string

Ldflags returns the linker flags a binary built with s for goos needs: the static link of OpenSSLStatic everywhere but on macOS, which has no static libc.

func (SSL) Tags

func (s SSL) Tags() []string

Tags returns the build tags of a binary built with s.

type Version

type Version struct {
	// Tag is the tag the commit is at, or past it as git describe --tags
	// prints the commit.
	Tag string
	// Commit is the abbreviated hash of the commit.
	Commit string
	// CommitsSinceTag is the number of commits since the tag, in decimal.
	CommitsSinceTag string
	// Label is the label of the build.
	Label string
}

Version is the version a tt binary is stamped with, as git describe tells it of the checkout of tt the binary is built from.

func (Version) Ldflags

func (v Version) Ldflags() []string

Ldflags returns the linker flags that stamp v into the binary. A core of tt without the variables they set is built as if they were not given.

Jump to

Keyboard shortcuts

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