source

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package source dumps the source code of the current binary to standard output.

It adds the -source flag, that should call the function source.Dump(), for this the binary's source needs to have a go embed directive:

//go:embed *.go
var code embed.FS
// ...
if *source.Flag {
	source.Dump(code)
}

Index

Constants

This section is empty.

Variables

View Source
var Flag = flag.Bool("source", false, "dump source code to standard output")

Flag is the -source flag that gets added to the default set of flags.

Functions

func Dump

func Dump(code embed.FS, w ...io.Writer) error

Dump dumps all *.go files to w. If there is more than 1 go file they get a 'more'-like header:

::::::::::::::
file..go
::::::::::::::

If w isn't specified, os.Stdout is assumed. Only the first writer will be used when it is provided.

Types

This section is empty.

Jump to

Keyboard shortcuts

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