Skip to content

Commit

Permalink
feat(GoMod): Specify the required version
Browse files Browse the repository at this point in the history
Prepare for reading the VCS info from '.info' files under
'$GOPATH/pkg/mod' which is available only as of Go version 1.19, see
also [1].

[1]: golang/go#44742 (comment).

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Feb 22, 2023
1 parent b6b4932 commit 3a51585
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions analyzer/src/main/kotlin/managers/GoMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ import org.ossreviewtoolkit.utils.common.stashDirectories
import org.ossreviewtoolkit.utils.common.withoutSuffix
import org.ossreviewtoolkit.utils.ort.createOrtTempDir

import org.semver4j.RangesList
import org.semver4j.RangesListFactory

/**
* The [Go Modules](https://github.com/golang/go/wiki/Modules) package manager for Go.
*
Expand Down Expand Up @@ -97,6 +100,8 @@ class GoMod(

override fun transformVersion(output: String) = output.removePrefix("go version go").substringBefore(' ')

override fun getVersionRequirement(): RangesList = RangesListFactory.create("[1.19.0,)")

override fun mapDefinitionFiles(definitionFiles: List<File>): List<File> =
definitionFiles.filterNot { definitionFile ->
"vendor" in definitionFile
Expand Down

0 comments on commit 3a51585

Please sign in to comment.