Skip to content

Add some code quality tools and CI automation #14

@egregors

Description

@egregors

To make the project more pretty for contributing and easy for PR management we should make a few things:

  • add gofmt and golint into Makefile
  • add pre-commit hooks with formating code and linting
  • add GitHub Action with the install, build, lint, test steps for all PR's
  • add GitHub Action for automating upload new version into brew

gofmt – std tool for formatting source code, running it before commits are dramatically good practice.

golint – the same, but for linting. This tool usually helps write code more idiomatically

even now (with really small code base) golint suggest many improvements:

➜  underblog git:(master) ✗ golint ./app/...
app/cmd/blog.go:18:7: exported const DefaultMarkdownPath should have comment or be unexported
app/cmd/blog.go:20:1: comment on exported function NewBlog should be of the form "NewBlog ..."
app/cmd/blog.go:71:13: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
app/cmd/blog.go:77:13: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
app/cmd/blog.go:130:16: method copyCssToPublicDir should be copyCSSToPublicDir
app/cmd/post.go:17:1: exported function NewPost should have comment or be unexported
app/cmd/post.go:62:6: exported type Post should have comment or be unexported
app/cmd/underblog.go:9:1: exported function MakeBlog should have comment or be unexported
app/cmd/underblog.go:14:10: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
app/internal/cli.go:7:6: exported type Opts should have comment or be unexported

@freetonik are the GitHub actions available for this repo? Only owner or collaborator may figure it out

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions