From 9e183714070f464b1ef089da3df8048aff1abeda Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Wed, 28 Oct 2020 17:53:13 +0100 Subject: [PATCH] Improved formatted and tests. Signed-off-by: Bartlomiej Plotka --- .errcheck_excludes.txt | 3 + .golangci.yml | 76 +++++++++++++++++++ CHANGELOG.md | 5 +- Makefile | 13 ++-- README.md | 15 ++-- go.mod | 2 +- go.sum | 7 +- main.go | 9 ++- pkg/mdformatter/mdformatter.go | 2 +- pkg/mdformatter/mdformatter_test.go | 24 ++++-- pkg/mdformatter/testdata/formatted.md | 1 + .../testdata/formatted_and_transformed.md | 1 + pkg/mdformatter/transformer.go | 3 + pkg/mdgen/mdgen.go | 4 + pkg/mdgen/mdgen_test.go | 41 ++++++---- pkg/mdgen/testdata/cfg.go | 3 + pkg/mdgen/testdata/embed_in_unknown_format.md | 4 - .../{test.md => testdata/mdgen_formatted.md} | 3 +- .../{embed_in.md => mdgen_not_formatted.md} | 5 +- pkg/runutil/example_test.go | 3 + pkg/runutil/runutil.go | 7 +- pkg/runutil/runutil_test.go | 3 + pkg/version/version.go | 2 +- scripts/copyright/copyright.go | 11 +-- 24 files changed, 181 insertions(+), 66 deletions(-) create mode 100644 .errcheck_excludes.txt create mode 100644 .golangci.yml delete mode 100644 pkg/mdgen/testdata/embed_in_unknown_format.md rename pkg/mdgen/{test.md => testdata/mdgen_formatted.md} (98%) rename pkg/mdgen/testdata/{embed_in.md => mdgen_not_formatted.md} (91%) diff --git a/.errcheck_excludes.txt b/.errcheck_excludes.txt new file mode 100644 index 0000000..4e175ab --- /dev/null +++ b/.errcheck_excludes.txt @@ -0,0 +1,3 @@ +(github.com/go-kit/kit/log.Logger).Log +fmt.Fprintln +fmt.Fprint diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..3b1ea1f --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,76 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 5m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # which dirs to skip: they won't be analyzed; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but next dirs are always skipped independently + # from this option's value: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs: vendor + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" + format: colored-line-number + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + +linters: + enable: + # Sorted alphabetically. + - deadcode + - errcheck + - goconst + - godot + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - structcheck + - typecheck + - unparam + - unused + - varcheck + +linters-settings: + errcheck: + exclude: ./.errcheck_excludes.txt + misspell: + locale: US + goconst: + min-occurrences: 5 + +issues: + exclude-rules: + # These are not being checked since these methods exist + # so that no one else could implement them. + - linters: + - unused + text: "SourceStoreAPI.implementsStoreAPI" + - linters: + - unused + text: "SourceStoreAPI.producesBlocks" + - linters: + - unused + text: "Source.producesBlocks" + - linters: + - unused + text: "newMockAlertmanager" + - linters: + - unused + text: "ruleAndAssert" diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b0820..efb9a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,12 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). NOTE: As semantic versioning states all 0.y.z releases can contain breaking changes in API (flags, grpc API, any backward compatibility) We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) -## Unreleased +## [v0.1.0]() Initial release. diff --git a/Makefile b/Makefile index 2afbf9d..dad8e00 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,10 @@ FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print GO111MODULE ?= on export GO111MODULE -GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin # Tools. -GIT ?= $(shell which git) +GIT ?= $(shell which git) # Support gsed on OSX (installed via brew), falling back to sed. On Linux # systems gsed won't be installed, so will use sed as expected. @@ -41,7 +41,7 @@ all: format build .PHONY: build build: ## Build mdox. @echo ">> building mdox" - @go install github.com/bwplotka/mdox + @GOBIN=$(GOBIN) go install github.com/bwplotka/mdox .PHONY: check-comments check-comments: ## Checks Go code comments if they have trailing period (excludes protobuffers and vendor files). Comments with more than 3 spaces at beginning are omitted from the check, example: '// - foo'. @@ -55,7 +55,8 @@ deps: ## Ensures fresh go.mod and go.sum. .PHONY: docs docs: build ## Generates config snippets and doc formatting. - @$(GOBIN)/mdox fmt *.md + @echo ">> generating docs $(PATH)" + @PATH=$(GOBIN) mdox fmt *.md .PHONY: format format: ## Formats Go code including imports and cleans up white noise. @@ -86,7 +87,7 @@ endif # --mem-profile-path string Path to memory profile output file # to debug big allocations during linting. lint: ## Runs various static analysis against our code. -lint: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) format docs check-git deps +lint: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) build format docs check-git deps $(call require_clean_work_tree,"detected not clean master before running lint") @echo ">> verifying modules being imported" @$(FAILLINT) -paths "errors=github.com/pkg/errors" ./... @@ -101,4 +102,4 @@ lint: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) format docs check-git deps @find . -type f \( -name "*.md" -o -name "*.go" \) | SED_BIN="$(SED)" xargs scripts/cleanup-white-noise.sh @echo ">> ensuring Copyright headers" @go run ./scripts/copyright/... - $(call require_clean_work_tree,"detected white noise or/and files without copyright; run 'make lint' file and commit changes.") + $(call require_clean_work_tree,"detected white noise or/and files without copyright; run make lint file and commit changes.") diff --git a/README.md b/README.md index 0830607..cdbd600 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@ # mdox -[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/bwplotka/mdox) -[![Latest Release](https://img.shields.io/github/release/bwplotka/mdox.svg?style=flat-square)](https://github.com/bwplotka/mdox/releases/latest) -[![CI](https://github.com/bwplotka/mdox/workflows/go/badge.svg)](https://github.com/bwplotka/mdox/actions?query=workflow%3Ago) -[![Go Report Card](https://goreportcard.com/badge/github.com/bwplotka/mdox)](https://goreportcard.com/report/github.com/bwplotka/mdox) +[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/bwplotka/mdox) [![Latest Release](https://img.shields.io/github/release/bwplotka/mdox.svg?style=flat-square)](https://github.com/bwplotka/mdox/releases/latest) [![CI](https://github.com/bwplotka/mdox/workflows/go/badge.svg)](https://github.com/bwplotka/mdox/actions?query=workflow%3Ago) [![Go Report Card](https://goreportcard.com/badge/github.com/bwplotka/mdox)](https://goreportcard.com/report/github.com/bwplotka/mdox) CLI toolset for maintaining automated, high quality project documentation and website leveraging markdown and git. -Goal: Allow projects to have self-updating up-to-date documentation available in both markdown (e.g readable from GitHub) and static HTML. Hosted in the same repository as code, -fool-proof and integrated with Pull Requests CI and hosting CD. +Goal: Allow projects to have self-updating up-to-date documentation available in both markdown (e.g readable from GitHub) and static HTML. Hosted in the same repository as code, fool-proof and integrated with Pull Requests CI and hosting CD. ### Features @@ -44,6 +40,8 @@ Commands: web gen ... Generate versioned docs + + ``` ### Production Usage @@ -67,9 +65,8 @@ or via [bingo](github.com/bwplotka/bingo) if want to pin it: bingo get -u github.com/bwplotka/mdox ``` -Any contributions are welcome! Just use GitHub Issues and Pull Requests as usual. -We follow [Thanos Go coding style](https://thanos.io/contributing/coding-style-guide.md/) guide. +Any contributions are welcome! Just use GitHub Issues and Pull Requests as usual. We follow [Thanos Go coding style](https://thanos.io/contributing/coding-style-guide.md/) guide. ## Initial Author -[@bwplotka](https://bwplotka.dev) \ No newline at end of file +[@bwplotka](https://bwplotka.dev) diff --git a/go.mod b/go.mod index 4bc51b2..f0d3852 100644 --- a/go.mod +++ b/go.mod @@ -18,4 +18,4 @@ require ( gopkg.in/alecthomas/kingpin.v2 v2.2.6 ) -replace github.com/Kunde21/markdownfmt/v2 => github.com/bwplotka/markdownfmt/v2 v2.0.0-20201027235426-cd85d2653c78 +replace github.com/Kunde21/markdownfmt/v2 => github.com/bwplotka/markdownfmt/v2 v2.0.0-20201129164736-749754008490 diff --git a/go.sum b/go.sum index dbfe6c9..ebc7145 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/bep/gitmap v1.1.2/go.mod h1:g9VRETxFUXNWzMiuxOwcudo6DfZkW9jOsOW0Ft4kY github.com/bep/golibsass v0.6.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA= github.com/bep/tmc v0.5.1/go.mod h1:tGYHN8fS85aJPhDLgXETVKp+PR382OvFi2+q2GkGsq0= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bwplotka/markdownfmt/v2 v2.0.0-20201027235426-cd85d2653c78 h1:Cq42gMQ3fPsTks1ONNXv+s2p6CTh9uWrUd4xJE5EOOI= -github.com/bwplotka/markdownfmt/v2 v2.0.0-20201027235426-cd85d2653c78/go.mod h1:50JNMOFTYtR8g1f+U8BZlw0M9RL5ZUqjOxxTgITeyrg= +github.com/bwplotka/markdownfmt/v2 v2.0.0-20201129164736-749754008490 h1:wP/QJown7dFXZp5N4HCNk39iDWkczn4F8noYqA8Wcbg= +github.com/bwplotka/markdownfmt/v2 v2.0.0-20201129164736-749754008490/go.mod h1:niFn22lPHG2owQ+pHRB0bz3tkrCuVjvlUy4iFdRY+Bo= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -266,9 +266,10 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvOrs2Gw= github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= diff --git a/main.go b/main.go index e25af86..dbedc0a 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + package main import ( @@ -61,7 +64,7 @@ func main() { var g run.Group g.Add(func() error { - // TODO(bwplotka): Move to customised better setup function. + // TODO(bwplotka): Move to customized better setup function. return runner(ctx, logger) }, func(err error) { cancel() @@ -110,14 +113,12 @@ This directive runs executable with arguments and put its stderr and stdout outp Example: mdox fmt *.md `) files := cmd.Arg("files", "Markdown file(s) to process.").Required().ExistingFiles() - - // TODO(bwplotka): Format markdown files, check and lint links for uniform styles. Adjust links? cmd.Run(func(ctx context.Context, logger log.Logger) error { return mdformatter.Format(ctx, logger, *files, mdformatter.WithCodeBlockTransformer(mdgen.NewCodeBlockTransformer())) }) } -func registerWeb(ctx context.Context, app *extkingpin.App) { +func registerWeb(_ context.Context, app *extkingpin.App) { cmd := app.Command("web", "Tools for generating static HTML website based on https://gohugo.io/ on every PR with preview") genCmd := cmd.Command("gen", "Generate versioned docs") diff --git a/pkg/mdformatter/mdformatter.go b/pkg/mdformatter/mdformatter.go index e970afd..edce2b6 100644 --- a/pkg/mdformatter/mdformatter.go +++ b/pkg/mdformatter/mdformatter.go @@ -156,7 +156,7 @@ func (f *Formatter) Format(file *os.File, out io.Writer) error { } } - // hack: run Convert two times to ensure deterministic whitespace alignment. + // Hack: run Convert two times to ensure deterministic whitespace alignment. // This also immediately show transformers which are not working well together etc. tmp := bytes.Buffer{} if err := gm.Convert(content, &tmp); err != nil { diff --git a/pkg/mdformatter/mdformatter_test.go b/pkg/mdformatter/mdformatter_test.go index da60435..88ba527 100644 --- a/pkg/mdformatter/mdformatter_test.go +++ b/pkg/mdformatter/mdformatter_test.go @@ -23,13 +23,13 @@ func TestFormat_FormatSingle_NoTransformers(t *testing.T) { exp, err := ioutil.ReadFile("testdata/formatted.md") testutil.Ok(t, err) - t.Run("Formatter not formatted", func(t *testing.T) { + t.Run("Format not formatted", func(t *testing.T) { buf := bytes.Buffer{} testutil.Ok(t, f.Format(file, &buf)) testutil.Equals(t, string(exp), buf.String()) }) - t.Run("Formatter formatted", func(t *testing.T) { + t.Run("Format formatted", func(t *testing.T) { file2, err := os.OpenFile("testdata/formatted.md", os.O_RDONLY, 0) testutil.Ok(t, err) defer file2.Close() @@ -62,10 +62,22 @@ func TestFormat_FormatSingle_Transformers(t *testing.T) { f := New(context.Background()) f.link = mockLinkTransformer{} - buf := bytes.Buffer{} - testutil.Ok(t, f.Format(file, &buf)) - exp, err := ioutil.ReadFile("testdata/formatted_and_transformed.md") testutil.Ok(t, err) - testutil.Equals(t, string(exp), buf.String()) + + t.Run("Format not formatted", func(t *testing.T) { + buf := bytes.Buffer{} + testutil.Ok(t, f.Format(file, &buf)) + testutil.Equals(t, string(exp), buf.String()) + }) + + t.Run("Format formatted", func(t *testing.T) { + file2, err := os.OpenFile("testdata/formatted_and_transformed.md", os.O_RDONLY, 0) + testutil.Ok(t, err) + defer file2.Close() + + buf := bytes.Buffer{} + testutil.Ok(t, f.Format(file2, &buf)) + testutil.Equals(t, string(exp), buf.String()) + }) } diff --git a/pkg/mdformatter/testdata/formatted.md b/pkg/mdformatter/testdata/formatted.md index f3f5180..6e7934a 100644 --- a/pkg/mdformatter/testdata/formatted.md +++ b/pkg/mdformatter/testdata/formatted.md @@ -376,6 +376,7 @@ Flags: (used as a fallback) --query.sd-dns-interval=30s Interval between DNS resolutions. + ``` ## Configuration diff --git a/pkg/mdformatter/testdata/formatted_and_transformed.md b/pkg/mdformatter/testdata/formatted_and_transformed.md index 8c742b0..72f66be 100644 --- a/pkg/mdformatter/testdata/formatted_and_transformed.md +++ b/pkg/mdformatter/testdata/formatted_and_transformed.md @@ -376,6 +376,7 @@ Flags: (used as a fallback) --query.sd-dns-interval=30s Interval between DNS resolutions. + ``` ## Configuration diff --git a/pkg/mdformatter/transformer.go b/pkg/mdformatter/transformer.go index 94a6d00..0498276 100644 --- a/pkg/mdformatter/transformer.go +++ b/pkg/mdformatter/transformer.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + package mdformatter import ( diff --git a/pkg/mdgen/mdgen.go b/pkg/mdgen/mdgen.go index 202c766..f87110c 100644 --- a/pkg/mdgen/mdgen.go +++ b/pkg/mdgen/mdgen.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + package mdgen import ( @@ -87,5 +90,6 @@ func (t *genCodeBlockTransformer) TransformCodeBlock(ctx context.Context, docPat } func genGo(ctx context.Context, moduleRoot string, typePath string) ([]byte, error) { + // TODO(bwplotka): To be done. return nil, nil } diff --git a/pkg/mdgen/mdgen_test.go b/pkg/mdgen/mdgen_test.go index 8d4e063..858686d 100644 --- a/pkg/mdgen/mdgen_test.go +++ b/pkg/mdgen/mdgen_test.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + package mdgen import ( @@ -11,19 +14,29 @@ import ( "github.com/bwplotka/mdox/pkg/testutil" ) -func TestEmbed(t *testing.T) { - file, err := os.OpenFile("testdata/embed_in.md", os.O_RDONLY, 0) +func TestFormat_FormatSingle_CodeBlockTransformer(t *testing.T) { + f := mdformatter.New(context.Background(), mdformatter.WithCodeBlockTransformer(NewCodeBlockTransformer())) + + exp, err := ioutil.ReadFile("testdata/mdgen_formatted.md") testutil.Ok(t, err) - defer file.Close() - - f := mdformatter.New(context.Background(), mdformatter.WithCodeBlockTransformer(&genCodeBlockTransformer{})) - - buf := bytes.Buffer{} - testutil.Ok(t, f.Format(file, &buf)) - testutil.Ok(t, ioutil.WriteFile("test.md", buf.Bytes(), os.ModePerm)) - // - //exp, err := ioutil.ReadFile("testdata/embed_in.md") - //testutil.Ok(t, err) - //fmt.Println(string(exp)) - //testutil.Equals(t, string(exp), buf.String()) + + t.Run("Format not formatted", func(t *testing.T) { + file, err := os.OpenFile("testdata/mdgen_not_formatted.md", os.O_RDONLY, 0) + testutil.Ok(t, err) + defer file.Close() + + buf := bytes.Buffer{} + testutil.Ok(t, f.Format(file, &buf)) + testutil.Equals(t, string(exp), buf.String()) + }) + + t.Run("Format formatted", func(t *testing.T) { + file2, err := os.OpenFile("testdata/mdgen_formatted.md", os.O_RDONLY, 0) + testutil.Ok(t, err) + defer file2.Close() + + buf := bytes.Buffer{} + testutil.Ok(t, f.Format(file2, &buf)) + testutil.Equals(t, string(exp), buf.String()) + }) } diff --git a/pkg/mdgen/testdata/cfg.go b/pkg/mdgen/testdata/cfg.go index 24a276e..5efa0d9 100644 --- a/pkg/mdgen/testdata/cfg.go +++ b/pkg/mdgen/testdata/cfg.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + package testdata import "github.com/prometheus/common/model" diff --git a/pkg/mdgen/testdata/embed_in_unknown_format.md b/pkg/mdgen/testdata/embed_in_unknown_format.md deleted file mode 100644 index 3a62744..0000000 --- a/pkg/mdgen/testdata/embed_in_unknown_format.md +++ /dev/null @@ -1,4 +0,0 @@ -Quick Tutorial -============== - - diff --git a/pkg/mdgen/test.md b/pkg/mdgen/testdata/mdgen_formatted.md similarity index 98% rename from pkg/mdgen/test.md rename to pkg/mdgen/testdata/mdgen_formatted.md index a426676..282aa28 100755 --- a/pkg/mdgen/test.md +++ b/pkg/mdgen/testdata/mdgen_formatted.md @@ -5,8 +5,7 @@ test output ``` ```yaml mdox-gen-lang="go" mdox-gen-type="github.com/bwplotka/mdox/pkg/mdox/testdata.Config" -ab -ad +TO BE DONE ``` ```yaml diff --git a/pkg/mdgen/testdata/embed_in.md b/pkg/mdgen/testdata/mdgen_not_formatted.md similarity index 91% rename from pkg/mdgen/testdata/embed_in.md rename to pkg/mdgen/testdata/mdgen_not_formatted.md index b0737f7..a4b0bcb 100644 --- a/pkg/mdgen/testdata/embed_in.md +++ b/pkg/mdgen/testdata/mdgen_not_formatted.md @@ -1,14 +1,13 @@ Quick Tutorial ============== -```bash mdox-gen-exec="bash ./testdata/out.sh" +```bash mdox-gen-exec="bash ./testdata/out.sh" a adf ``` ```yaml mdox-gen-lang="go" mdox-gen-type="github.com/bwplotka/mdox/pkg/mdox/testdata.Config" -ab -ad +TO BE DONE ``` ```yaml diff --git a/pkg/runutil/example_test.go b/pkg/runutil/example_test.go index 8163d5f..58f1828 100644 --- a/pkg/runutil/example_test.go +++ b/pkg/runutil/example_test.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + // Taken from Thanos // // Copyright (c) The Thanos Authors. diff --git a/pkg/runutil/runutil.go b/pkg/runutil/runutil.go index e83b4ff..3cd7495 100644 --- a/pkg/runutil/runutil.go +++ b/pkg/runutil/runutil.go @@ -1,4 +1,7 @@ -// Taken from Thanos +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + +// Taken from Thanos. // // Copyright (c) The Thanos Authors. // Licensed under the Apache License 2.0. @@ -164,7 +167,7 @@ func ExhaustCloseWithErrCapture(err *error, r io.ReadCloser, format string, a .. // Errors used to construct it. type MultiError []error -// Returns a concatenated string of the contained errors +// Returns a concatenated string of the contained errors. func (es MultiError) Error() string { var buf bytes.Buffer diff --git a/pkg/runutil/runutil_test.go b/pkg/runutil/runutil_test.go index aab1599..3ebc2ae 100644 --- a/pkg/runutil/runutil_test.go +++ b/pkg/runutil/runutil_test.go @@ -1,3 +1,6 @@ +// Copyright (c) Bartłomiej Płotka @bwplotka +// Licensed under the Apache License 2.0. + // Taken from Thanos // // Copyright (c) The Thanos Authors. diff --git a/pkg/version/version.go b/pkg/version/version.go index 879b744..6dbd757 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -4,4 +4,4 @@ package version // Version returns 'mdox' version. -const Version = "v0.0.0-dev" +const Version = "v0.1.0" diff --git a/scripts/copyright/copyright.go b/scripts/copyright/copyright.go index a267444..0a95d3a 100644 --- a/scripts/copyright/copyright.go +++ b/scripts/copyright/copyright.go @@ -37,13 +37,10 @@ func applyLicenseToProtoAndGo() error { if strings.HasSuffix(path, ".pb.go") { return nil } - //if (filepath.Ext(path) != ".proto" && filepath.Ext(path) != ".go") || - // // We copied this file and we want maintain its license (MIT). - // path == "pkg/testutil/testutil.go" || - // // Generated file. - // path == "pkg/ui/bindata.go" { - // return nil - //} + + if filepath.Ext(path) != ".proto" && filepath.Ext(path) != ".go" { + return nil + } b, err := ioutil.ReadFile(path) if err != nil {