dbg

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 2 Imported by: 2

README

go-windows-dbg

This package provides the functions to output text to debuggers on Windows

( Renamed and simplified from go-outputdebug )

  • On Windows, the functions call the OutputDebugStringW API
  • With the compile option -tags=ndebug, debug strings are discarded
  • On non-Windows operating systems, the functions do nothing
  • You can check if debugging is enabled or disabled by referring to dbg.Enabled

Example-1

package main

import (
    "github.com/nyaosorg/go-windows-dbg"
)

func main() {
    dbg.Print("output", 1, "text")
    dbg.Printf("output<%d>text", 1)
    dbg.Println("output", 1, "text")

    println("Enabled=", dbg.Enabled)
}
> start dbgview.exe
> go run example.go

Screenshot of DebugView for Windows

screen shot

Example-2

dbg.X is the small function similar with dbg! on Rust.

package main

import (
    "github.com/nyaosorg/go-windows-dbg"
)

func main() {
    println(dbg.X(1 + 2))
}
> start dbgview.exe
> go run example2.go
3

screen shot

Documentation

Index

Constants

View Source
const Enabled = true

Enable is the switch to output to OutputDebugStringW

Variables

This section is empty.

Functions

func OutputDebugString

func OutputDebugString(s string) error

func Print

func Print(v ...interface{}) (int, error)

func Printf

func Printf(format string, v ...interface{}) (int, error)

func Println

func Println(v ...interface{}) (int, error)

func X added in v0.0.9

func X[T any](v T) T

Types

This section is empty.

Jump to

Keyboard shortcuts

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