dbg

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 6 Imported by: ? 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 dbg provides debugging helpers that print an expression together with its source file, line and enclosing function (dbg.Dbg, dbg.CallerInfo).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerInfo

func CallerInfo() string

CallerInfo retrieves and formats the file name and line number of the caller's location in the source code.

It uses the runtime.Caller function to determine the caller's file and line information.

Example usage:

callerInfo := CallerInfo()
fmt.Println("Caller:", callerInfo)

The output will look like this:

Caller: [filename:line] [function]

Where "filename" is the name of the file where the caller is located, "line" is the line number in that file, and "function" is the name of the enclosing function.

func Dbg

func Dbg(exp any)

Dbg is a debugging utility function that prints the given expression and its location in the source code. Error values are written to standard error, all other values to standard output. It also prints the file name and line number where the Dbg function is called.

Parameters:

exp  - The expression or value to be printed.

Example:

Dbg(someValue)

The output will look like this:

[filename:line] [function] variable = value

Where "filename" is the name of the file where Dbg is called, "line" is the line number in that file, "function" is the name of the enclosing function, "variable" is the variable or expression being debugged, and "value" is the value of the expression.

Types

This section is empty.

Jump to

Keyboard shortcuts

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