utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LibPath, LibVersion string = func() (string, string) {
	pkg := reflect.TypeFor[marker]().PkgPath()
	info, ok := debug.ReadBuildInfo()
	if !ok {
		return pkg, "dev"
	}
	best, version := "", "dev"
	check := func(m *debug.Module) {
		if m == nil || m.Path == "" {
			return
		}
		if (pkg == m.Path || strings.HasPrefix(pkg, m.Path+"/")) && len(m.Path) > len(best) {
			best, version = m.Path, m.Version
			if m.Replace != nil && m.Replace.Version != "" {
				version = m.Replace.Version
			}
		}
	}
	check(&info.Main)
	for _, dep := range info.Deps {
		check(dep)
	}
	if best == "" {
		best = pkg
	}
	if version == "" || version == "(devel)" {
		version = "dev"
	}
	return best, version
}()

Functions

func NewID

func NewID() string

func SanitizeName

func SanitizeName(name string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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