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

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.

Owner
Dimitar Petrov
We cannot solve our problems with the same thinking we used when we created them. - Albert Einstein
Dimitar Petrov
Similar Resources

General Golang Code Generator

gg gg is a General Golang Code Generator: A Good Game to play with Golang. package main import ( "fmt" . "github.com/Xuanwo/gg" ) func main() {

Jan 7, 2023

Protocol Buffers to HTTP client code generator/converter

Proto2http Proto2http provides a code generation tool to convert your protocol buffers (.proto) files into invokable HTTP request. Usage proto2http -p

Oct 23, 2022

Host yo' self from your browser, your phone, your toaster.

Host yo' self from your browser, your phone, your toaster.

A hosting service from the browser, because why not. Try it at hostyoself.com. See it in action Here's an example where I use hostyoself.com to host i

Jan 1, 2023

:guardsman: A teeny tiny and somewhat opinionated generator for your next golang project

A Yeoman Golang Generator We are very sorry Gophers, but other names for the generator where taken, so we choose go-lang. But we have gocreate as an a

Sep 27, 2022

The High Code Framework (low-code for devs)

hof - the high code framework The hof tool tries to remove redundent development activities by using high level designs, code generation, and diff3 wh

Dec 24, 2022

🎄 My code for the Advent of Code of year 2021 in Go.

Advent of Code 2021 This repository contains all code that I wrote for the Advent of Code 2021. This year I chose to try and learn Go. Enjoy! Built wi

Dec 9, 2021

An unified key management system to make life easier.

An unified key management system to make life easier.

Safebox An unified key management system to make life easier. The main goal of safebox is to make key backup easier with single main key to derive the

Nov 15, 2022

CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API.

✨ CapMonsterTool ✨ About this module What is ✨ CapMonsterTool ✨ ? CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonst

Dec 1, 2022

Mpq Decoder Golang TODO: MAke Description

MPQ MPQ archive codec Report Bug · Request Feature About This package provides a MPQ archive codec, for compressing and decompressing MoPaQ archives.

Nov 2, 2021
Comments
  • Add support for godot

    Add support for godot

    Awesome tool, it will be awesome if you can add support for https://github.com/tetafro/godot. Basically, it will add . at the end of the comment if it's missing it.

    // This is comment
    

    after running godot fix

    // This is comment.
    
Code snippets by first time open source contributors

Introduction Golang code snippets by first time open source contributors Rules How to contribute Add a folder and create your desired code snippet fil

Oct 6, 2021
🦉 Docuowl generates a static single-page documentation from Markdown files
🦉 Docuowl generates a static single-page documentation from Markdown files

?? Docuowl generates a static single-page documentation from Markdown files

Jan 2, 2023
A vitamin C rich, book, pdf & documentation brewing library for e-readers/e-ink readers
A vitamin C rich, book, pdf & documentation brewing library for e-readers/e-ink readers

go-Cbook A vitamin C rich, book, pdf & documentation brewing library for e-readers/e-ink readers. Now take priviliges of (eye-safe) e-readers to read

Dec 28, 2021
Initialize structs with default values

defaults Initialize structs with default values Supports almost all kind of types Scalar types int/8/16/32/64, uint/8/16/32/64, float32/64 uintptr, bo

Jan 7, 2023
Build for all Go-supported platforms by default, disable those which you don't want.

bagop Build for all Go-supported platforms by default, disable those which you don't want. Overview bagop is a simple build tool for Go which tries to

Jul 29, 2022
Generate FIRST/FOLLOW/PREDICT Set from BNF.

Generate FIRST/FOLLOW/PREDICT Set from BNF. We can use it to study parser theory. Feature FirstSet generate. Output pretty. FollowSet generate. Output

Oct 30, 2021
Golang SSR-first Frontend Library
Golang SSR-first Frontend Library

kyoto Library that brings frontend-like components experience to the server side with native html/template on steroids. Supports any serving basis (ne

Nov 25, 2022
This application is a tool that allows you to prepare mail designs specific to your group and make Christmas raffles.

What is this? This application is a tool that allows you to prepare mail designs specific to your group and make Christmas raffles. How is it working?

Dec 15, 2022
XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator

xgen Introduction xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This li

Jan 1, 2023
Jennifer is a code generator for Go

Jennifer Jennifer is a code generator for Go. package main import ( "fmt" . "github.com/dave/jennifer/jen" ) func main() { f := NewFile("m

Dec 25, 2022