internal

package
v5.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Overview

Package internal provides additional utility functions that are needed in elPrep.

Index

Constants

View Source
const (
	// PedanticMode is a Boolean flag for conditional compilation
	PedanticMode = false

	// PedanticMessage can be added to the overall program message
	PedanticMessage = ""
)

Variables

View Source
var BQSRTablenamePrefix string

Functions

func BinaryRead

func BinaryRead(r io.Reader, data interface{})

BinaryRead is binary.Read with panics in place of errors

func BoolHash

func BoolHash(b bool) uint64

BoolHash returns a hash value for the given boolean value.

func Close

func Close(f io.Closer)

Close is f.Close with panics in place of errors

func Copy

func Copy(dst io.Writer, src io.Reader) int64

Copy is io.Copy with panics in place of errors

func Directory

func Directory(file string) (directory string, files []string)

Directory returns a slice of filenames. If the given filename refers to a directory, return a slice of names of files that are in this directory. If the given filename does not refer to a directory, return a slice with this filename as the only entry. Directory returns a slice of filenames. If the given filename refers to a directory, return a slice of names of files that are in this directory. If the given filename does not refer to a directory, return a slice with this filename as the only entry.

func FileCreate

func FileCreate(name string) *os.File

FileCreate is os.Create with panics in place of errors

func FileCreateAppendIfExists added in v5.0.1

func FileCreateAppendIfExists(name string) *os.File

FileCreateAppendIfExists creates a new file or opens if it already exists for appending

func FileOpen

func FileOpen(name string) *os.File

FileOpen is os.Open with panics in place of errors

func FileOpenIfExists

func FileOpenIfExists(name string) (*os.File, bool)

FileOpenIfExists is os.Oppen with panics in place of errors. Returns an additional boolean flag to indicate whether the actually exists or not.

func FilepathAbs

func FilepathAbs(path string) string

FilepathAbs is filepath.Abs with panics in place of errors

func MkdirAll

func MkdirAll(path string, perm os.FileMode)

MkdirAll is os.MkdirAll with panics in place of errors

func ParseFloat

func ParseFloat(s string, bitSize int) float64

ParseFloat is strconv.ParseFloat with panics in place of errors

func ParseInt

func ParseInt(s string, base, bitSize int) int64

ParseInt is strconv.ParseInt with panics in place of errors

func ParseUint

func ParseUint(s string, base, bitSize int) uint64

ParseUint is strconv.ParseUint with panics in place of errors

func RandReflect

func RandReflect(r *Rand) int64

RandReflect works only in pedantic mode, so just panics unconditionally.

func ReadFull

func ReadFull(r io.Reader, buf []byte) int

ReadFull is io.ReadFull with panics in place of errors

func RunCmd

func RunCmd(cmd *exec.Cmd)

RunCmd is cmd.Run() with panics in place of errors

func RunPipeline

func RunPipeline(p *pipeline.Pipeline)

RunPipeline is p.Run() with panics in place of errors

func StringHash

func StringHash(s string) (hash uint64)

StringHash returns a hash value for the given string value.

func Write

func Write(f io.Writer, b []byte) int

Write is f.Write with panics in place of errors

func WriteByte

func WriteByte(f io.ByteWriter, b byte)

WriteByte is f.WriteByte with panics in place of errors

func WriteString

func WriteString(f io.StringWriter, s string) int

WriteString is f.WriteString with panics in place of errors

Types

type Rand

type Rand = rand.Rand

func NewRand

func NewRand(seed int64) *Rand

NewRand returns a Go-style random number generator.

func NewRandReflect

func NewRandReflect(seed int64) *Rand

NewRandReflect works only in pedantic mode, so just panics unconditionally.

Jump to

Keyboard shortcuts

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