doctor

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package doctor 诊断本机/CI 是否满足 appkit 多私有仓库开发的前置条件。

针对的就是最常见的翻车现场:GOPRIVATE 没设 → go 去 sum.golang.org 校验私有 模块得到 404;git 走匿名 https → "could not read Username"。每项检查都给出 可直接复制的修复命令。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFailure

func HasFailure(cs []Check) bool

HasFailure 报告是否存在 Fail 级检查(CLI 以此决定退出码)。

Types

type Check

type Check struct {
	Name   string
	Status Status
	Detail string
	Fix    string
}

Check 是一项诊断结果。Fix 在 Status != OK 时给出可执行的修复指引。

func Run

func Run(o Options) []Check

Run 执行全部检查。任何一项 Fail 表示"接下来的构建/拉取必然出问题"。

type Options

type Options struct {
	Dir    string // 待诊断的仓库目录;空 = 只做全局环境检查
	Prefix string // 私有 module 前缀,默认 github.com/forgeplex

	GoEnv     func(dir string, keys ...string) (map[string]string, error)
	GitConfig func() (string, error) // git config --get-regexp ^url\.
	LookPath  func(file string) (string, error)
	ReadFile  func(name string) ([]byte, error)
	Home      string
}

Options 的注入点仅供测试;零值字段使用真实实现。

type Status

type Status int
const (
	OK Status = iota
	Warn
	Fail
)

Jump to

Keyboard shortcuts

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