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 ParseModFileOrReader(modFile string, r io.Reader) (*modfile.File, error)
- func RemoveHelpers(modDir string) error
- func SortRenderables(pkgs []PackageRenderable)
- type ModFile
- func (mf *ModFile) AutoReplaceDisabled() bool
- func (mf *ModFile) Close() error
- func (mf *ModFile) DirectPackage() *Package
- func (mf *ModFile) FileName() string
- func (mf *ModFile) Flush() error
- func (mf *ModFile) Reload() (err error)
- func (mf *ModFile) SetDirectRequire(target Package) (err error)
- func (mf *ModFile) SetReplace(target ...*modfile.Replace) (err error)
- type Package
- type PackageRenderable
- 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" NoReplaceCommand = "bingo:no_replace_fetch" )
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 ParseModFileOrReader ¶ added in v0.3.0
ParseModFileOrReader parses any module file or reader allowing to read it's content.
func RemoveHelpers ¶ added in v0.2.0
RemoveHelpers deletes helpers from mod directory.
func SortRenderables ¶ added in v0.3.0
func SortRenderables(pkgs []PackageRenderable)
Types ¶
type ModFile ¶ added in v0.3.0
type ModFile struct {
// contains filtered or unexported fields
}
ModFile represents bingo tool .mod file.
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) AutoReplaceDisabled ¶ added in v0.3.0
func (*ModFile) DirectPackage ¶ added in v0.3.0
func (*ModFile) Flush ¶ added in v0.3.0
Flush saves all changes made to parsed syntax and reloads the parsed file.
func (*ModFile) SetDirectRequire ¶ added in v0.3.0
SetDirectRequire removes all require statements and set to the given one. It supports package level versioning. It's caller responsibility to Flush all changes.
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.
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 ListPinnedMainPackages ¶ added in v0.2.2
func ListPinnedMainPackages(logger *log.Logger, modDir string, remMalformed bool) (pkgs []PackageRenderable, _ error)
ListPinnedMainPackages lists all bingo pinned binaries (Go main packages) in the same order as seen in the filesystem.
func (PackageRenderable) ToPackages ¶ added in v0.3.0
func (p PackageRenderable) ToPackages() []Package
type PackageVersionRenderable ¶ added in v0.3.0
PackageVersionRenderable is used in variables.go. Modify with care.