jfrog go-publish fails in workspace mode
Describe the bug
Running go-publish from a subdirectory (module) of a multi-module workspace fails.
Current behavior
[Info] Using go: go1.20
[Info] Running 'go list -mod=mod -m' in <dir omitted>
[Error] Failed running Go command: 'go list -mod=mod -m' in <dir-omitted> with error: 'exit status 1 - go: -mod may only be set to readonly when in workspace mode, but it is set to "mod"
Remove the -mod flag to use the default readonly value,
or set GOWORK=off to disable workspace mode.
Reproduction steps
Execute jfrog gp v1.0.0 in a subdirectory (module) of a workspace whose root contains a go.work.
Expected behavior
Within a subdirectory representing a single module, that module should be published.
Ideally, running from the root containing a go.work directory should publish all modules.
Up for some discussion on exact desired behavior, but the current failure is not ideal.
Presumably the go list command could be invoked with -mod=readonly rather than -mod=mod?
JFrog CLI version
2.34.2
Operating system type and version
debian:11.6-slim
JFrog Artifactory version
7.41.12
JFrog Xray version
No response
Is there any solution to this? This bug has been opened for almost a year now. With evolving usage of go workspace, we will need this sooner than later.
This appears to be hard coded in https://github.com/jfrog/build-info-go/blob/main/utils/goutils.go#L91 also https://github.com/jfrog/jfrog-cli-core/blob/master/artifactory/commands/golang/archive.go#L118 might need to be updated
Also hitting this issue with doing local build step.
Would greatly appreciate if this could be made a priority. important project has mono-repo structure.
maybe a flag for workspace mode could be provided.
jf go build --build-name=ascii-zoo-v0.0.2 --build-number=1
17:26:48 [🔵Info] Using go: go1.22.4
17:26:48 [🔵Info] Running 'go list -mod=mod -m' in /Users/gshepard/go/src/ascii-zoo/sdk/gozoo
17:26:48 [🔵Info] Trace ID for JFrog Platform logs: 956b574c05e4c935
17:26:48 [🚨Error] Failed running Go command: 'go list -mod=mod -m' in /Users/gshepard/go/src/ascii-zoo/sdk/gozoo with error: 'exit status 1 - go: -mod may only be set to readonly or vendor ### when in workspace mode, but it is set to "mod"
Remove the -mod flag to use the default readonly value,
or set GOWORK=off to disable workspace mode.
before seeing this is hardcoded, tried setting GOFLAGS to
-mod=readonly does not change the behavior either.
go env -w GOFLAGS=-mod=readonly
This issue has been marked as stale due to 6 months of inactivity. As part of our effort to address every issue properly, please feel free to remove the stale label or keep this issue active by leaving a comment. Otherwise, it will be closed in 7 days
This issue was closed due to 7 days of inactivity after being marked as stale. Feel free to reopen it if it remains relevant.