/usr/share/gocode/src/github.com/sanity-io/litter/print.go is in golang-github-sanity-io-litter-dev 1.1.0+git20171129.f8fd6a5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package litter
import (
"io"
"strconv"
)
func printBool(w io.Writer, value bool) {
if value {
w.Write([]byte("true"))
return
}
w.Write([]byte("false"))
}
func printInt(w io.Writer, val int64, base int) {
w.Write([]byte(strconv.FormatInt(val, base)))
}
func printUint(w io.Writer, val uint64, base int) {
w.Write([]byte(strconv.FormatUint(val, base)))
}
func printFloat(w io.Writer, val float64, precision int) {
w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))
}
func printComplex(w io.Writer, c complex128, floatPrecision int) {
w.Write([]byte("complex"))
printInt(w, int64(floatPrecision*2), 10)
r := real(c)
w.Write([]byte("("))
w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))
i := imag(c)
if i >= 0 {
w.Write([]byte("+"))
}
w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))
w.Write([]byte("i)"))
}
func printNil(w io.Writer) {
w.Write([]byte("nil"))
}
|