From ce231f1b8f0ef1adccc3764c2e64f995994dfcaf Mon Sep 17 00:00:00 2001 From: Lucas Bremgartner Date: Tue, 19 Sep 2023 22:30:34 +0200 Subject: [PATCH] Fix different capabilities on windows for github.com/google/uuid --- pkg/depcaps/depcaps.go | 3 +-- pkg/depcaps/depcaps_linux_test.go | 7 +++++++ pkg/depcaps/depcaps_test.go | 2 ++ pkg/depcaps/depcaps_windows_test.go | 7 +++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 pkg/depcaps/depcaps_linux_test.go create mode 100644 pkg/depcaps/depcaps_windows_test.go diff --git a/pkg/depcaps/depcaps.go b/pkg/depcaps/depcaps.go index e620684..b6512cf 100644 --- a/pkg/depcaps/depcaps.go +++ b/pkg/depcaps/depcaps.go @@ -112,8 +112,7 @@ func (d *depcaps) run(pass *analysis.Pass) (interface{}, error) { packageNames := []string{pass.Pkg.Path()} - var classifier analyzer.Classifier - classifier = analyzer.GetClassifier(true) + var classifier analyzer.Classifier = analyzer.GetClassifier(true) // TODO: can this be optimized, since we get the packages already from pass? pkgs := analyzer.LoadPackages(packageNames, diff --git a/pkg/depcaps/depcaps_linux_test.go b/pkg/depcaps/depcaps_linux_test.go new file mode 100644 index 0000000..876f7b7 --- /dev/null +++ b/pkg/depcaps/depcaps_linux_test.go @@ -0,0 +1,7 @@ +package depcaps_test + +import ( + "github.com/breml/depcaps/pkg/depcaps" +) + +func osSpecificLinterSettings(linterSettings *depcaps.LinterSettings) {} diff --git a/pkg/depcaps/depcaps_test.go b/pkg/depcaps/depcaps_test.go index de5a4bd..0141340 100644 --- a/pkg/depcaps/depcaps_test.go +++ b/pkg/depcaps/depcaps_test.go @@ -112,6 +112,8 @@ func TestAll(t *testing.T) { } }() + osSpecificLinterSettings(tc.linterSettings) + analysistest.Run(t, testCaseDir, tc.analyzerFunc(tc.linterSettings), ".") }) } diff --git a/pkg/depcaps/depcaps_windows_test.go b/pkg/depcaps/depcaps_windows_test.go new file mode 100644 index 0000000..1f252e5 --- /dev/null +++ b/pkg/depcaps/depcaps_windows_test.go @@ -0,0 +1,7 @@ +package depcaps_test + +import "github.com/breml/depcaps/pkg/depcaps" + +func osSpecificLinterSettings(linterSettings *depcaps.LinterSettings) { + linterSettings.GlobalAllowedCapabilities["CAPABILITY_SYSTEM_CALLS"] = true +}