Documentation ¶
Index ¶
- Constants
- func GenHelpers(relModDir, version string, pkgs []PackageRenderable) error
- func ModIndirectModules(modFile string) (mods []module.Version, err error)
- func NameFromModFile(modFile string) (name string, oneOfMany bool)
- func RemoveHelpers(modDir string) error
- func SortRenderables(pkgs []PackageRenderable)
- func SumFilePath(modFilePath string) string
- type ModFile
- type Package
- type PackageRenderable
- type PackageRenderables
- type PackageVersionRenderable
Constants ¶
const ( // FakeRootModFileName is a name for fake go module that we have to maintain, until https://github.com/bwplotka/bingo/issues/20 is fixed. FakeRootModFileName = "go.mod" NoDirectiveCommand = "bingo:no_directive_fetch" PackageRenderablesPrintHeader = "Name\tBinary Name\tPackage @ Version\tBuild EnvVars\tBuild Flags\n" + "----\t-----------\t-----------------\t-------------\t-----------\n" )
Variables ¶
This section is empty.
Functions ¶
func GenHelpers ¶ added in v0.2.0
func GenHelpers(relModDir, version string, pkgs []PackageRenderable) error
GenHelpers generates helpers to allows reliable binaries use. Regenerate if needed. It is expected to have at least one mod file. TODO(bwplotka): Allow installing those optionally?
func ModIndirectModules ¶ added in v0.3.0
ModIndirectModules return the all indirect mod from any module file.
func NameFromModFile ¶
NameFromModFile returns binary name from module file path.
func RemoveHelpers ¶ added in v0.2.0
RemoveHelpers deletes helpers from mod directory.
func SortRenderables ¶ added in v0.3.0
func SortRenderables(pkgs []PackageRenderable)
func SumFilePath ¶ added in v0.7.0
Types ¶
type ModFile ¶ added in v0.3.0
ModFile is a wrapper over module file with bingo specific data.
func CreateFromExistingOrNew ¶ added in v0.3.0
func CreateFromExistingOrNew(ctx context.Context, r *runner.Runner, logger *log.Logger, existingFile, modFile string) (*ModFile, error)
CreateFromExistingOrNew creates and opens new bingo enhanced module file. If existing file exists and is not malformed it copies this as the source, otherwise completely new is created. It's a caller responsibility to Close the file when not using anymore.
func OpenModFile ¶ added in v0.3.0
OpenModFile opens bingo mod file. It also adds meta if missing and trims all require direct module imports except first within the parsed syntax. It's a caller responsibility to Close the file when not using anymore.
func (*ModFile) DirectPackage ¶ added in v0.3.0
func (*ModFile) IsDirectivesAutoFetchDisabled ¶ added in v0.5.0
func (*ModFile) SetDirectRequire ¶ added in v0.3.0
SetDirectRequire removes all require statements and set to the given one. It supports package level versioning.
type Package ¶ added in v0.3.0
type Package struct { Module module.Version // RelPath is a path that together with Module.Path composes a package path, like "/pkg/makefile". // Empty if the module is a full package path. // If Module.Path is empty and RelPath specified, it means that we don't know what is a module what is the package path. RelPath string // BuildEnvs are environment variables to be used during go build process. BuildEnvs envars.EnvSlice // BuildFlags are flags to be used during go build process. BuildFlags []string }
A Package (for clients, a bingo.Package) is defined by a module path, package relative path and version pair. These are stored in their plain (unescaped) form.
func ModDirectPackage ¶
ModDirectPackage return the first direct package from bingo enhanced module file. The package suffix (if any) is encoded in the line comment, in the same line as module and version.
func (Package) String ¶ added in v0.3.0
String returns a representation of the Package suitable for `go` tools and logging. (Module.Path/[email protected], or Module.Path/RelPath if Version is empty).
type PackageRenderable ¶ added in v0.3.0
type PackageRenderable struct { Name string ModPath string PackagePath string EnvVarName string Versions []PackageVersionRenderable BuildFlags []string BuildEnvVars []string }
PackageRenderable is used in variables.go. Modify with care.
func (PackageRenderable) ToPackages ¶ added in v0.3.0
func (p PackageRenderable) ToPackages() []Package
type PackageRenderables ¶ added in v0.4.2
type PackageRenderables []PackageRenderable
func ListPinnedMainPackages ¶ added in v0.2.2
func ListPinnedMainPackages(logger *log.Logger, modDir string, remMalformed bool) (pkgs PackageRenderables, _ error)
ListPinnedMainPackages lists all bingo pinned binaries (Go main packages) in the same order as seen in the filesystem.
type PackageVersionRenderable ¶ added in v0.3.0
PackageVersionRenderable is used in variables.go. Modify with care.