Documentation ¶
Overview ¶
Package bespoke provides a way to create custom binaries: files that are executable that also contain additional data. The data can either be a key-value map or an arbitrary file.
Motivation ¶
A common use for the Go language is creating command-line tools. As a concrete example, consider a web application that allows its users to download a command-line client to interact with it. The client may need to be configured with such things as the user name or an access token. Using bespoke you can create a binary that is specifically configured for each user who downloads it.
Example ¶
See documentation for examples/server for a simple HTTP server that serves bespoke binaries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractMap ¶
ExtractMap extracts the map[string]string that was packaged with the currently executing binary. The map is written at filePath as a JSON file.
Types ¶
type Bespoke ¶
type Bespoke struct {
// contains filtered or unexported fields
}
Bespoke represents a packaged bespoke binary. It is created by the functions bespoke.WithMap() and bespoke.WithFile(). It acts as an io.Reader and the contents of the bespoke binary can be accessed through Read().
func WithFile ¶
WithFile creates a bespoke binary from the executable exe and the given file. The executable can access the file by calling bespoke.ReadFile()
func WithMap ¶
WithMap creates a bespoke binary from the executable exe and the given map. The executable can access the map by calling bespoke.Map()
Directories ¶
Path | Synopsis |
---|---|
Command bespoke provides a way to create bespoke binaries.
|
Command bespoke provides a way to create bespoke binaries. |
examples
|
|
hello
Command hello is a simple example of a bespoke binary.
|
Command hello is a simple example of a bespoke binary. |
server
Command server is a simple HTTP server that demonstrates usage of the bespoke package.
|
Command server is a simple HTTP server that demonstrates usage of the bespoke package. |