golangci

command module
v0.0.0-...-c6e0a78 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 2 Imported by: 0

README

Plugin for golangci-lint

Interfaceguard plugin for golangci-lint

Example Config

.golangci.yml

linters-settings:
  custom:
    interfaceguard:
      type: module
      description: interfaceguard checks subtle interface-related issues, including improper comparisons and type mismatches.
      original-url: https://github.com/jkeys089/interfaceguard
      settings:
        # Disable check for direct interface-to-interface comparisons.
        # Default: false
        disable-interface-to-interface: true
        # Disable check for direct interface-to-nil comparisons.
        # Default: false
        disable-interface-to-nil: true

linters:
  disable-all: true
  enable:
    - interfaceguard

How To Run

Preferred Method - utilize golangci-lint custom command:

  1. create a .custom-gcl.yml config like below (see reference for all options):
    version: v1.60.3
    plugins:
      - module: 'github.com/jkeys089/interfaceguard/plugin/golangci'
        import: 'github.com/jkeys089/interfaceguard/plugin/golangci/module'
        version: latest
    
  2. build and run custom-gcl
    golangci-lint custom
    ./custom-gcl linters | grep interfaceguard
    ./custom-gcl run ./...
    

Alternative Method - utilize the go plugin package (requires golangci-lint be built with CGO_ENABLED and only supported on Linux, FreeBSD, and macOS):

  1. build the plugin for your system:
    git clone https://github.com/jkeys089/interfaceguard
    cd interfaceguard/plugin/golangci
    go build -o interfaceguard.so -buildmode=plugin plugin.go
    
  2. update linters-settings.custom.interfaceguard in .golangci.yml to use path param instead of type: module:
    linters-settings:
      custom:
        interfaceguard:
          path: /path/to/interfaceguard.so
          description: interfaceguard checks subtle interface-related issues, including improper comparisons and type mismatches.
          original-url: https://github.com/jkeys089/interfaceguard
          settings:
            # Disable check for direct interface-to-interface comparisons.
            # Default: false
            disable-interface-to-interface: true
            # Disable check for direct interface-to-nil comparisons.
            # Default: false
            disable-interface-to-nil: true
    
    linters:
      disable-all: true
      enable:
        - interfaceguard
    
  3. run golangci-lint as normal
golangci-lint linters | grep interfaceguard
golangci-lint run ./...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳