You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace existing Go detector with Go117 detector (#1426)
* Replace existing go detector with go117 detector
* Fix unit tests for the new implementation of go detector
* Handle replace directives in go mod parser, fix UTs
* Fix UT that breaks due to path
* Change go detector docs to document new behavior
* Remove all references to Go117
---------
Co-authored-by: Aayush Maini <aamaini@microsoft.com>
Copy file name to clipboardExpand all lines: docs/detectors/go.md
+13-58Lines changed: 13 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,22 +8,24 @@ Go detection runs when one of the following files is found in the project:
8
8
9
9
## Default Detection strategy
10
10
11
-
Default Go detection depends on the following to successfully run:
11
+
### go.mod
12
+
- All go.mod are parsed to detect dependencies. This parsing doesn't depend on presence of `go cli`.
12
13
13
-
- Go v1.11+.
14
+
### go cli (go list) or go.sum Parsing
15
+
- If a `go.sum` file is found, detector first checks if go version in the adjacent `go.mod` >= `1.17`. If it is `>= 1.17`, the file is skipped. If it is `< 1.17`, the detector proceeds as follows. Read [Go Module Changes in Go 1.17](#go-module-changes-in-go-117) to understand why `1.17` is relevant.
16
+
- If `go cli` is found and not [disabled](#environment-variables), `go list` command is preferred over parsing `go.sum` file since `go.sum` files contains history of dependencies and including these dependencies can lead to [over-reporting](#known-limitations).
17
+
- If `go list` was not used or did not run successfully, detector falls back to parsing `go.sum` manually.
14
18
19
+
### Dependency graph generation
15
20
Full dependency graph generation is supported if Go v1.11+ is present
16
-
on the build agent. If no Go v1.11+ is present, fallback detection
17
-
strategy is performed.
18
-
19
-
Go detection is performed by parsing output from executing
20
-
[go list -mod=readonly -m -json all][1]. To generate the graph, the command
21
+
on the build agent. To generate the graph, the command
21
22
[go mod graph][2] is executed. This only adds edges between the components
22
-
that were already registered by `go list`.
23
+
that were already registered.
23
24
24
25
## Fallback Detection strategy
25
26
26
-
The fallback detections trategy is known to overreport (see the
27
+
The fallback strategy refers to detector parsing `go.sum` manually.
28
+
TThis strategy is known to overreport (see the
27
29
[known limitations](#known-limitations)). Read through the
0 commit comments