GithubHelp home page GithubHelp logo

dimitarpetrov / godoc-generate Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 4.0 22 KB

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

License: MIT License

Go 100.00%
golang go godoc generator documentation documentation-generator code-comments code-quality

godoc-generate's Introduction

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.

godoc-generate's People

Contributors

arsssen avatar dimitarpetrov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

godoc-generate's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.