-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
278 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package golinters | ||
|
||
import ( | ||
"sort" | ||
"testing" | ||
|
||
"golang.org/x/tools/go/analysis" | ||
"golang.org/x/tools/go/analysis/passes/shadow" | ||
) | ||
|
||
func TestGovet(t *testing.T) { | ||
// Checking that every default analyzer is in "all analyzers" list. | ||
allAnalyzers := getAllAnalyzers() | ||
checkList := append(getDefaultAnalyzers(), | ||
shadow.Analyzer, // special case, used in analyzersFromConfig | ||
) | ||
for _, defaultAnalyzer := range checkList { | ||
found := false | ||
for _, a := range allAnalyzers { | ||
if a.Name == defaultAnalyzer.Name { | ||
found = true | ||
break | ||
} | ||
} | ||
if !found { | ||
t.Errorf("%s is not in allAnalyzers", defaultAnalyzer.Name) | ||
} | ||
} | ||
} | ||
|
||
type sortedAnalyzers []*analysis.Analyzer | ||
|
||
func (p sortedAnalyzers) Len() int { return len(p) } | ||
func (p sortedAnalyzers) Less(i, j int) bool { return p[i].Name < p[j].Name } | ||
func (p sortedAnalyzers) Swap(i, j int) { p[i].Name, p[j].Name = p[j].Name, p[i].Name } | ||
|
||
func TestGovetSorted(t *testing.T) { | ||
// Keeping analyzers sorted so their order match the import order. | ||
t.Run("All", func(t *testing.T) { | ||
if !sort.IsSorted(sortedAnalyzers(getAllAnalyzers())) { | ||
t.Error("please keep all analyzers list sorted by name") | ||
} | ||
}) | ||
t.Run("Default", func(t *testing.T) { | ||
if !sort.IsSorted(sortedAnalyzers(getDefaultAnalyzers())) { | ||
t.Error("please keep default analyzers list sorted by name") | ||
} | ||
}) | ||
} |
126 changes: 126 additions & 0 deletions
126
vendor/golang.org/x/tools/go/analysis/passes/atomicalign/atomicalign.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters