Skip to content

Formatting is a golang library for formatting text. Currently its main use is to share a code-formatting text writer

License

Notifications You must be signed in to change notification settings

travissimon/formatting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Formatting library

Formatting is a small (one file) library for formatting text. Currently it only contains the IndentingWriter class, which is used to write text with variable amounts of whitespace at the beginning of a line. Generally this would be used to format source code, like this:

buffer := bytes.NewBuffer(make([]byte, 0))
ind := formatting.NewIndentingWriter(buffer)

ind.Println("for {")
ind.IncrIndent()
ind.Println("// Do some stuff")
ind.DecrIndent()
ind.Println("}")

Copyright / License

Copyright 2013 Travis Simon

Licensed under the GNU General Public License Version 2.0 (or later); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Formatting is a golang library for formatting text. Currently its main use is to share a code-formatting text writer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages