Skip to content

Commit

Permalink
refactor: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Aug 30, 2024
1 parent e8aaef4 commit 175b542
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/dependency/parser/golang/mod/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ func toolchainVersion(toolchain *modfile.Toolchain, goVer *modfile.Go) string {
return ""
}

// toolchainVersionFromGoLine detects Go version from `go` line if `toolchain` line is omitted
// toolchainVersionFromGoLine detects Go version from `go` line if `toolchain` line is omitted.
// `go` line supports the following formats:
// cf. https://go.dev/doc/toolchain#version
// - `1.N.P`. e.g. `1.22.0`
// - `1.N`. e.g. `1.22`
// - `1.NrcR`. e.g. `1.22rc1`
// - `1.NbetaR`. e.g. `1.18beta1` - only for 1.20 or early
// - `1.NbetaR`. e.g. `1.18beta1` - only for Go 1.20 or earlier
func toolchainVersionFromGoLine(ver string) string {
var majorMinorVer string

Expand All @@ -222,7 +222,8 @@ func toolchainVersionFromGoLine(ver string) string {
majorMinorVer = v
} else { // `1.N`
majorMinorVer = ver
// Add `.0` suffix to avoid user confusing
// Add `.0` suffix to avoid user confusing.
// See https://github.com/aquasecurity/trivy/pull/7163#discussion_r1682424315
ver = v + ".0"
}

Expand Down

0 comments on commit 175b542

Please sign in to comment.