Movatterモバイル変換


[0]ホーム

URL:


testlog

packagestandard library
go1.25.5Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:3Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Overview

Package testlog provides a back-channel communication pathbetween tests and package os, so that cmd/go can see whichenvironment variables and files a test consults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcGetenv

func Getenv(namestring)

Getenv calls Logger().Getenv, if a logger has been set.

funcOpen

func Open(namestring)

Open calls Logger().Open, if a logger has been set.

funcPanicOnExit0added ingo1.16

func PanicOnExit0()bool

PanicOnExit0 reports whether to panic on a call to os.Exit(0).This is in the testlog package because, like other definitions inpackage testlog, it is a hook between the testing package and theos package. This is used to ensure that an early call to os.Exit(0)does not cause a test to pass.

funcSetLogger

func SetLogger(implInterface)

SetLogger sets the test logger implementation for the current process.It must be called only once, at process startup.

funcSetPanicOnExit0added ingo1.16

func SetPanicOnExit0(vbool)

SetPanicOnExit0 sets panicOnExit0 to v.

SetPanicOnExit0 should be an internal detail,but alternate implementations of go test in otherbuild systems may need to access it using linkname.

Do not remove or change the type signature.See go.dev/issue/67401.

funcStat

func Stat(namestring)

Stat calls Logger().Stat, if a logger has been set.

Types

typeInterface

type Interface interface {Getenv(keystring)Stat(filestring)Open(filestring)Chdir(dirstring)}

Interface is the interface required of test loggers.The os package will invoke the interface's methods to indicate thatit is inspecting the given environment variables or files.Multiple goroutines may call these methods simultaneously.

funcLogger

func Logger()Interface

Logger returns the current test logger implementation.It returns nil if there is no logger.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp