mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-19 05:21:03 +01:00
added
This commit is contained in:
56
vendor/github.com/shurcooL/go-goon/goon.go
generated
vendored
Normal file
56
vendor/github.com/shurcooL/go-goon/goon.go
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Package goon is a deep pretty printer with Go-like notation. It implements the goon specification.
|
||||
//
|
||||
// Deprecated: This package is old, incomplete, low code quality, and now unmaintained.
|
||||
// See github.com/hexops/valast for a newer package that is the closest known direct replacement.
|
||||
// See the Alternatives section in README.md for other known entries in this problem space.
|
||||
package goon
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/shurcooL/go/reflectsource"
|
||||
)
|
||||
|
||||
// Dump dumps goons to stdout.
|
||||
func Dump(a ...interface{}) (n int, err error) {
|
||||
return os.Stdout.Write(bdump(a...))
|
||||
}
|
||||
|
||||
// Sdump dumps goons to a string.
|
||||
func Sdump(a ...interface{}) string {
|
||||
return string(bdump(a...))
|
||||
}
|
||||
|
||||
// Fdump dumps goons to a writer.
|
||||
func Fdump(w io.Writer, a ...interface{}) (n int, err error) {
|
||||
return w.Write(bdump(a...))
|
||||
}
|
||||
|
||||
// DumpExpr dumps goon expressions to stdout.
|
||||
//
|
||||
// E.g., this:
|
||||
//
|
||||
// somethingImportant := 5
|
||||
// DumpExpr(somethingImportant)
|
||||
//
|
||||
// Will print:
|
||||
//
|
||||
// somethingImportant = (int)(5)
|
||||
func DumpExpr(a ...interface{}) (n int, err error) {
|
||||
return os.Stdout.Write(bdumpNamed(reflectsource.GetParentArgExprAllAsString(), a...))
|
||||
}
|
||||
|
||||
// SdumpExpr dumps goon expressions to a string.
|
||||
func SdumpExpr(a ...interface{}) string {
|
||||
return string(bdumpNamed(reflectsource.GetParentArgExprAllAsString(), a...))
|
||||
}
|
||||
|
||||
// FdumpExpr dumps goon expressions to a writer.
|
||||
func FdumpExpr(w io.Writer, a ...interface{}) (n int, err error) {
|
||||
names := reflectsource.GetParentArgExprAllAsString()
|
||||
if len(names) >= 1 {
|
||||
names = names[1:] // First argument is the writer, skip it.
|
||||
}
|
||||
return w.Write(bdumpNamed(names, a...))
|
||||
}
|
||||
Reference in New Issue
Block a user