Guess go main module version based on binary contents (#2608)

* guess go main module version based on binary contents

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* add configuration options for golang main module version heuristics

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix test setup for go bin cataloger

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix unit test

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix incorrect test assert ordering

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* handle error from seek

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-02-09 19:52:42 +00:00
committed by GitHub
parent 737c4e44c5
commit 84576b93e1
9 changed files with 309 additions and 94 deletions
+3 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
)
func Test_Options(t *testing.T) {
func Test_Config(t *testing.T) {
type opts struct {
local bool
cacheDir string
@@ -51,6 +51,7 @@ func Test_Options(t *testing.T) {
SearchRemoteLicenses: false,
Proxies: []string{"https://my.proxy"},
NoProxy: []string{"my.private", "no.proxy"},
MainModuleVersion: DefaultMainModuleVersionConfig(),
},
},
{
@@ -74,6 +75,7 @@ func Test_Options(t *testing.T) {
SearchRemoteLicenses: true,
Proxies: []string{"https://alt.proxy", "direct"},
NoProxy: []string{"alt.no.proxy"},
MainModuleVersion: DefaultMainModuleVersionConfig(),
},
},
}