
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github.com/reiver/go-indent
Package indent provides tools for indentation of UTF-8 text, for the Go programming language.
For example, if you take some text, package indent can make it so it puts tabs, or spaces for indentation in front of each non-empty line.
So, for example, this:
Hello world!
I came; I saw; I conquered.
Can becomes this:
Hello world!
I came; I saw; I conquered.
Or:
Hello world!
I came; I saw; I conquered.
Or:
-----Hello world!
-----I came; I saw; I conquered.
You can specify how much indentation you want, and what you want the indentation to be (ex: tabs, spaces, or any other symbol, or string).
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-indent
import "github.com/reiver/go-indent"
// ...
var writer io.Writer
// ...
var indentationWriter indent.Writer
indentationWriter.Indentation = "\t\t"
indentationWriter.Writer = writer
// ...
var s string =
"This is a sentence.\n"+
"This is another sentence.\n"+
"\n"+
"This is a new paragraph.\n"
// ...
io.WriteString(&indentationWriter, s) // <---- Note we write to the ‘indentationWriter’, and not ‘writer’.
// Result will be:
//
// "\t\tThis is a sentence.\n"+
// "\t\tThis is another sentence.\n"+
// "\n"+
// "\t\tThis is a new paragraph.\n"
//
// Note the "\t\t" indentation in front of each non-empty line.
//
// Note the empty line (i.e., "\n") did not get indentation.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.