description

package module
v0.0.0-...-8ea2e74 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 11 Imported by: 0

README

description

Generate and check description of all variables

package description // import "github.com/Konstantin8105/description"


CONSTANTS

const ListName string = "Description"
    ListName is name of typical description list


VARIABLES

var Description map[string]string = map[string]string{
	"filename":   "name of file",
	"filenames":  "names of files",
	"buf":        "bytes buffer for templorary strings",
	"rootFolder": "folder name for start seaching",
	"err":        "typical error",
	"warnings":   "list of warnings, you can ignore them",
	"unsort":     "unsorted list of variable names",
	"gofiles":    "prepared list of Go files, except Go test files",
	"lines":      "list of report strings",
	"ok":         "true if acceptable",

	"a": "", "bl": "", "cl": "", "ds": "", "et": "", "f": "",
	"d": "", "fset": "", "key": "", "value": "", "mt": "",
	"add": "", "vs": "", "vl": "", "v": "", "rep": "",
	"kv": "", "ListName": "", "fd": "", "gocode": "", "n": "",
	"name": "", "names": "", "ns": "", "val": "", "w": "",
}
    Description of package variables


FUNCTIONS

func Template(rootFolder string) (gocode string)
    Template return Go code for all variable names


TYPES

type List struct {
	// List of variable names
	Names []string

	// Founded description list in Go files
	Descr map[string]string
}
    List of descriptions parts

func New(rootFolder string) (list *List, err error)
    New return description data

func (l List) Report() (rep string, warnings error)
    Report return typical representation of description and warning for
    variables without description

Documentation

Overview

Example
package main

import (
	"fmt"
	"os"

	"github.com/Konstantin8105/description"
)

func main() {
	descr, err := description.New(".")
	if err != nil {
		panic(err)
	}
	rep, err := descr.Report()
	fmt.Fprintf(os.Stdout, "Report:\n%s\n", rep)
	if err != nil {
		fmt.Fprintf(os.Stdout, "\n%v\n", err)
	}

	tmpl := description.Template(".")
	fmt.Fprintf(os.Stdout, "Golang template:\n%s\n", tmpl)

}
Output:

Report:

buf        bytes buffer for templorary strings
err        typical error
filename   name of file
filenames  names of files
gofiles    prepared list of Go files, except Go test files
lines      list of report strings
ok         true if acceptable
rootFolder folder name for start seaching
unsort     unsorted list of variable names
warnings   list of warnings, you can ignore them

report errors:
├──Name `descr` have not description
├──Name `isTypeOk` have not description
└──Name `list` have not description

Golang template:
var Description map[string]string = map[string]string{
    "ListName":   "",
    "a":          "",
    "add":        "",
    "bl":         "",
    "buf":        "",
    "cl":         "",
    "d":          "",
    "descr":      "",
    "ds":         "",
    "err":        "",
    "et":         "",
    "f":          "",
    "fd":         "",
    "filename":   "",
    "filenames":  "",
    "fset":       "",
    "gocode":     "",
    "gofiles":    "",
    "isTypeOk":   "",
    "key":        "",
    "kv":         "",
    "lines":      "",
    "list":       "",
    "mt":         "",
    "n":          "",
    "name":       "",
    "names":      "",
    "ns":         "",
    "ok":         "",
    "rep":        "",
    "rootFolder": "",
    "unsort":     "",
    "v":          "",
    "val":        "",
    "value":      "",
    "vl":         "",
    "vs":         "",
    "w":          "",
    "warnings":   "",
}

Index

Examples

Constants

View Source
const ListName string = "Description"

ListName is name of typical description list

Variables

View Source
var Description map[string]string = map[string]string{
	"filename":   "name of file",
	"filenames":  "names of files",
	"buf":        "bytes buffer for templorary strings",
	"rootFolder": "folder name for start seaching",
	"err":        "typical error",
	"warnings":   "list of warnings, you can ignore them",
	"unsort":     "unsorted list of variable names",
	"gofiles":    "prepared list of Go files, except Go test files",
	"lines":      "list of report strings",
	"ok":         "true if acceptable",

	"a": "", "bl": "", "cl": "", "ds": "", "et": "", "f": "",
	"d": "", "fset": "", "key": "", "value": "", "mt": "",
	"add": "", "vs": "", "vl": "", "v": "", "rep": "",
	"kv": "", "ListName": "", "fd": "", "gocode": "", "n": "",
	"name": "", "names": "", "ns": "", "val": "", "w": "",
}

Description of package variables

Functions

func Template

func Template(rootFolder string) (gocode string)

Template return Go code for all variable names

Types

type List

type List struct {
	// List of variable names
	Names []string

	// Founded description list in Go files
	Descr map[string]string
}

List of descriptions parts

func New

func New(rootFolder string) (list *List, err error)

New return description data

func (List) Report

func (l List) Report() (rep string, warnings error)

Report return typical representation of description and warning for variables without description

Jump to

Keyboard shortcuts

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