util

package
v0.0.0-...-d4a6de4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: CC-BY-3.0, Freetype, GPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Overview

package util provides common utilities for all other packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Argument

func Argument(test bool)

Panics with "illegal argument" if test is false.

func Assert

func Assert(test bool)

Panics with "assertion failed" if test is false.

func AssertMsg

func AssertMsg(test bool, msg interface{})

Panics with msg if test is false

func Fatal

func Fatal(msg ...interface{})

func FatalErr

func FatalErr(err interface{})

If err != nil, trigger log.Fatal(msg, err)

func Fatalf

func Fatalf(format string, msg ...interface{})

func Fprint

func Fprint(out io.Writer, array ...interface{})

Produces nicely formatted output for multi-dimensional arrays.

func Fprintf

func Fprintf(out io.Writer, format string, array ...interface{})

Produces nicely formatted output for multi-dimensional arrays.

func FprintfFloats

func FprintfFloats(out io.Writer, format string, a [][][]float32)

Produces nicely formatted output.

func FprintfTensors

func FprintfTensors(out io.Writer, format string, a [][][][]float32)

Produces nicely formatted output.

func InterfaceAddrs

func InterfaceAddrs() []string

returns all network interface addresses, without CIDR mask

func Log

func Log(msg ...interface{})

func LogErr

func LogErr(err error, msg ...interface{})

Logs the error of non-nil, plus message

func NoExt

func NoExt(file string) string

Remove extension from file name.

func PanicErr

func PanicErr(err error)

Panics if err is not nil. Signals a bug.

func Print

func Print(array ...interface{})

Produces nicely formatted output for multi-dimensional arrays.

func PrintProgress

func PrintProgress(prog, total int, msg string)

func Printf

func Printf(format string, array ...interface{})

Produces nicely formatted output for multi-dimensional arrays.

func Println

func Println(array ...interface{})

Produces nicely formatted output for multi-dimensional arrays.

func Progress

func Progress(progress, total int, msg string)

Set progress bar to progress/total and display msg if GUI is up and running.

func SetProgress

func SetProgress(f func(int, int, string))

Sets the function to be used internally by Progress. Avoids cyclic dependency on engine.

func Sprint

func Sprint(array ...interface{}) string

Types

type Atom

type Atom int32

Atomic int

func (*Atom) Add

func (a *Atom) Add(v int32)

func (*Atom) Load

func (a *Atom) Load() int32

Jump to

Keyboard shortcuts

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