commfmt

command module
v0.0.0-...-565e439 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 4 Imported by: 0

README

Build Status

A standard for Go comments.

Installation

$ go get -u github.com/codingconcepts/commfmt

Usage

$ commfmt -h
Usage of commfmt:
  -p string
        the relative/absolute path of the root directory. (default ".")
  -w int
        the maximum width of comments. (default 80)

Example

Here's an example of running the commfmt tool against a directory containing the following code block:

$ commfmt -p . -w 40

Before:

// Aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa.
//
//     if err != nil {
//             return err
//     }
//
// Bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb.

After:

// Aaa  aaa aaa aaa aaa aaa aaa aaa aaa aaa
// aaa aaa aaa aaa aaa aaa.
// 
//     if err != nil {
//             return err
//     }
// 
// Bbb  bbb bbb bbb bbb bbb bbb bbb bbb bbb
// bbb bbb bbb bbb bbb bbb.

Todos

  • FIXME: Additional commented line when last paragraph is a code block.
  • FIXME: Comments should align to their original column position (currently moving to 0):

Before

func one() {
	// Ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc ccc.
	fmt.Println("Hello, World!")
}

After

func one() {
	// Ccc  ccc ccc ccc ccc ccc ccc ccc ccc ccc
// ccc ccc ccc ccc ccc ccc.
	fmt.Println("Hello, World!")
}
  • Consider /**/ code blocks.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

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