Skip to content

env ​

go
import "github.com/tangoui/tango/sys/env"

本页由 site/tools/apigen 从源码注释生成(按 darwin 构建标签选文件),请勿手改。

Package env describes the environment the app runs in: operating system and version, CPU architecture, whether this is a debug build, and the WebView engine.

Info is safe from any goroutine. Pass the app only once it runs (as tango.Await, it would otherwise wait for Run, or panic on the main goroutine); it is needed only for the WebView fields, which stay empty when the backend does not report them.

类型 ​

Environment ​

go
type Environment struct {
	OS        string // runtime.GOOS: "darwin", "windows", "linux", ...
	Arch      string // runtime.GOARCH
	OSName    string // "macOS", "Windows", "Ubuntu 24.04.1 LTS", ...
	OSVersion string // "15.3.1", "10.0.26100", kernel release on Linux
	// Debug is true in development builds (-tags tango_dev, as tan dev
	// builds) and false in production builds, the default.
	Debug bool
	// WebView names the page engine and its version when the backend
	// reports them: "WebKit" / "WebView2" / "WebKitGTK".
	WebView        string
	WebViewVersion string
}

Environment is a snapshot of the environment.

func Info ​

go
func Info(a *tango.App) Environment

Info returns the environment. a may be nil, which leaves the WebView fields empty; after the app quit they are empty too.

以 MIT 许可发布