1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-16 05:16:08 +02:00

versioning: fix panic when using go.mod (#1938)

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9830a6]
goroutine 1 [running]:
github.com/SAP/jenkins-library/pkg/versioning.searchDescriptor(0xc00067c060, 0x2, 0x2, 0x0, 0x0, 0xc0006549c0, 0xc0006413a0, 0x982ce0)
/home/runner/work/jenkins-library/jenkins-library/pkg/versioning/versioning.go:156 +0x76
github.com/SAP/jenkins-library/pkg/versioning.(*GoMod).GetVersion(0xc0006549c0, 0x6, 0x18089f1, 0x6, 0xc000664a80)
/home/runner/work/jenkins-library/jenkins-library/pkg/versioning/gomodfile.go:52 +0x18a
...
```
This commit is contained in:
Oliver Nocon 2020-08-20 12:39:41 +02:00 committed by GitHub
parent a2ce194301
commit 115025ce4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ func GetArtifact(buildTool, buildDescriptorFilePath string, opts *Options, execR
switch buildDescriptorFilePath {
case "go.mod":
artifact = &GoMod{path: buildDescriptorFilePath}
artifact = &GoMod{path: buildDescriptorFilePath, fileExists: fileExists}
break
default:
artifact = &Versionfile{path: buildDescriptorFilePath}