INNER CODE UNIT · Go

resolveOpkg

platform-engineering-labs/formae · cmd/bundle-examples/main.go:440

func resolveOpkg(arg string) (string, error) {
	if fi, err := os.Stat(arg); err == nil && !fi.IsDir() {
		return arg, nil
	}
	matches, _ := filepath.Glob(arg)
	if len(matches) == 0 {
		return "", fmt.Errorf("no opkg matched %q", arg)
	}
	if len(matches) == 1 {
		return matches[0], nil
	}
	newest, newestT := "", time.Time{}
	for _, mm := range matches {
		fi, err := os.Stat(mm)
		if err != nil {
			return "", err
		}
		if fi.ModTime().After(newestT) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…