godoc-generate

command module
v0.0.0-...-de86230 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 13 Imported by: 0

README

godoc-generate

Go Report Card

Overview

godoc-generate is a simple command line tool that generates default godoc comments on all exported types, functions, consts and vars in the current working directory and recursively for all subdirectories.

The godoc comments looks like this:

// %s missing godoc.

Where %s is the name of the type/func/const/var.

NOTE: The comment format can be overridden via the -format flag.

Installation

Installing from Source
go install github.com/DimitarPetrov/godoc-generate@latest

Demonstration

Let's say you have a simple Multiply function without godoc:

func Multiply(a,b int) int {
	return a * b
}

It is exported, therefore it is part of the package's interface. It is ideomatic to add godoc on everything exported in your package.

If you run godoc-genenrate the code will be rewritten the following way:

// Multiply missing godoc.
func Multiply(a, b int) int {
	return a * b
}

This way you are safe to add a linter enforcing godoc and migrate all legacy code gradually.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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