Skip to content

Commit

Permalink
Merge pull request #38 from gcpug/feat-plugin
Browse files Browse the repository at this point in the history
add plugin for golangci-lint
  • Loading branch information
tenntenn authored Sep 7, 2020
2 parents 98e6917 + 6a2ecce commit 49cc3a1
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
22 changes: 22 additions & 0 deletions passes/unclosetx/plugin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file can build as a plugin for golangci-lint by below command.
// go build -buildmode=plugin -o unclosetx.so github.com/gcpug/zagane/passes/unclosetx/plugin
// See: https://golangci-lint.run/contributing/new-linters/#how-to-add-a-private-linter-to-golangci-lint

package main

import (
"github.com/gcpug/zagane/passes/unclosetx"
"golang.org/x/tools/go/analysis"
)

// AnalyzerPlugin provides analyzers as a plugin.
// It follows golangci-lint style plugin.
var AnalyzerPlugin analyzerPlugin

type analyzerPlugin struct{}

func (analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
return []*analysis.Analyzer{
unclosetx.Analyzer,
}
}
22 changes: 22 additions & 0 deletions passes/unstopiter/plugin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file can build as a plugin for golangci-lint by below command.
// go build -buildmode=plugin -o unstopiter.so github.com/gcpug/zagane/passes/unstopiter/plugin
// See: https://golangci-lint.run/contributing/new-linters/#how-to-add-a-private-linter-to-golangci-lint

package main

import (
"github.com/gcpug/zagane/passes/unstopiter"
"golang.org/x/tools/go/analysis"
)

// AnalyzerPlugin provides analyzers as a plugin.
// It follows golangci-lint style plugin.
var AnalyzerPlugin analyzerPlugin

type analyzerPlugin struct{}

func (analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
return []*analysis.Analyzer{
unstopiter.Analyzer,
}
}
22 changes: 22 additions & 0 deletions passes/wraperr/plugin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file can build as a plugin for golangci-lint by below command.
// go build -buildmode=plugin -o wraperr.so github.com/gcpug/zagane/passes/wraperr/plugin
// See: https://golangci-lint.run/contributing/new-linters/#how-to-add-a-private-linter-to-golangci-lint

package main

import (
"github.com/gcpug/zagane/passes/wraperr"
"golang.org/x/tools/go/analysis"
)

// AnalyzerPlugin provides analyzers as a plugin.
// It follows golangci-lint style plugin.
var AnalyzerPlugin analyzerPlugin

type analyzerPlugin struct{}

func (analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
return []*analysis.Analyzer{
wraperr.Analyzer,
}
}
26 changes: 26 additions & 0 deletions plugin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file can build as a plugin for golangci-lint by below command.
// go build -buildmode=plugin -o zagane.so github.com/gcpug/zagane/plugin
// See: https://golangci-lint.run/contributing/new-linters/#how-to-add-a-private-linter-to-golangci-lint

package main

import (
"github.com/gcpug/zagane/passes/unclosetx"
"github.com/gcpug/zagane/passes/unstopiter"
"github.com/gcpug/zagane/passes/wraperr"
"golang.org/x/tools/go/analysis"
)

// AnalyzerPlugin provides analyzers as a plugin.
// It follows golangci-lint style plugin.
var AnalyzerPlugin analyzerPlugin

type analyzerPlugin struct{}

func (analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
return []*analysis.Analyzer{
unstopiter.Analyzer,
unclosetx.Analyzer,
wraperr.Analyzer,
}
}

0 comments on commit 49cc3a1

Please sign in to comment.