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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址