github.com/Johnny2210/revive@v1.0.8-0.20210625134200-febf37ccd0f5/DEVELOPING.md (about)

     1  # Developer's Guide
     2  
     3  This document explains how to build, test, and develop features for revive.
     4  
     5  ## Installation
     6  
     7  In order to install all the dependencies run:
     8  
     9  ```bash
    10  go get -u github.com/mgechev/revive
    11  cd $GOPATH/src/github.com/mgechev/revive
    12  ```
    13  
    14  After that install the dependencies using go modules:
    15  
    16  ```bash
    17  make install
    18  ```
    19  
    20  ## Build
    21  
    22  In order to build the project run:
    23  
    24  ```bash
    25  make build
    26  ```
    27  
    28  The command will produce the `revive` binary in the root of the project.
    29  
    30  ## Development of rules
    31  
    32  If you want to develop a new rule, follow as an example the already existing rules in the [rule package](https://github.com/mgechev/revive/tree/master/rule).
    33  
    34  All rules should implement the following interface:
    35  
    36  ```go
    37  type Rule interface {
    38  	Name() string
    39  	Apply(*File, Arguments) []Failure
    40  }
    41  ```
    42  
    43  ## Development of formatters
    44  
    45  If you want to develop a new formatter, follow as an example the already existing formatters in the [formatter package](https://github.com/mgechev/revive/tree/master/formatter).
    46  
    47  All formatters should implement the following interface:
    48  
    49  ```go
    50  type Formatter interface {
    51  	Format(<-chan Failure, RulesConfig) (string, error)
    52  	Name() string
    53  }
    54  ```