Skip to content

manuelarte/presentation-create-your-first-linter

Repository files navigation

Create Your First Linter

Here I have the content to give the presentation about how to create your first linter.

The goal of this presentation is to create a linter, and run:

🔗Link to the presentation

Tools

  • I am using reveal.js to create the slides.
  • I am using Jujutsu as a version control.

To start the slides, inside the ./slides/ folder, run:

npm start

Go Projects

Ast Example

Example on how the AST looks like for a small .go file

cd astexample && make t

Unexported Constants Check

Exercise to implement uber style guideline Prefix Unerxported Globals with _.

BadGood
// foo.go

const (
  defaultPort = 8080
  defaultUser = "user"
)

// bar.go

func Bar() {
  defaultPort := 9090
  ...
  fmt.Println("Default port", defaultPort)

  // We will not see a compile error if the first line of
  // Bar() is deleted.
}
// foo.go

const (
  _defaultPort = 8080
  _defaultUser = "user"
)

To implement: analyzer.go

Custom Module

Small web app to run custom plugin linters.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •