jfrog/jfrog-cli-core

SIGSEGV in jfrog-cli-core/artifactory/commands/generic/upload.go

jhinrichsen opened this issue · 0 comments

Problem
Panic when trying to upload a buffer to artifactory (equivalent to jfrog rt upload).

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9006f9]

goroutine 1 [running]:
github.com/jfrog/jfrog-cli-core/artifactory/commands/generic.(*UploadCommand).upload(0xc00010fda8, 0xc0003da560, 0x40)
        ~/go/pkg/mod/github.com/jfrog/jfrog-cli-core@v1.0.2/artifactory/commands/generic/upload.go:73 +0x79
github.com/jfrog/jfrog-cli-core/artifactory/commands/generic.(*UploadCommand).Run(...)
        ~/go/pkg/mod/github.com/jfrog/jfrog-cli-core@v1.0.2/artifactory/commands/generic/upload.go:54

Reproduce

Run this code:

        cmd := generic.NewUploadCommand()
        if err := cmd.Run(); err != nil {
                log.Fatal(err)
        }

Expected behavior
The compiler should refuse to build incomplete upload commands. Second best, users of the library should not have to guess what 'GoBeans' / 'POGO' must be used:

func (uc *UploadCommand) SetBuildConfiguration(buildConfiguration *utils.BuildConfiguration) *UploadCommand {
	uc.buildConfiguration = buildConfiguration
	return uc
}

func (uc *UploadCommand) UploadConfiguration() *utils.UploadConfiguration {
	return uc.uploadConfiguration
}

Additional context
Maybe i am missing documentation or examples somewhere?