Skip to content

Default godoc generator - make your first steps towards better code documentation

License

Notifications You must be signed in to change notification settings

DimitarPetrov/godoc-generate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Default godoc generator - make your first steps towards better code documentation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages