ort: [BUG] Analyzer fails with go.mod
Trying to analyze a Go project like this https://github.com/parvez3019/go-swagger3 ort crashes with this message
[DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.analyzer.PackageManager - Resolving GoMod dependencies for path 'go.mod' failed with: MissingKotlinParameterException: Instantiation of [simple type, class org.ossreviewtoolkit.analyzer.managers.ModuleInfoFile] value failed for JSON property Origin due to missing (therefore NULL) value for creator parameter origin which is a non-nullable type
at [Source: (File); line: 1, column: 50] (through reference chain: org.ossreviewtoolkit.analyzer.managers.ModuleInfoFile["Origin"])
The Analyzer used by ort was GoMod and the command used for testing was
./cli/build/install/ort/bin/ort analyze -i ~/go-swagger3/ -o ~/ort_results/
(built from sources)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 22 (9 by maintainers)
Commits related to this issue
- fix(GoMod): Fix analyzing `go.mod` files with unused dependencies The implementation uses `go list` to retrieve a list of `ModuleInfo`s. A `ModuleInfo` has a property named `GoMod` which points to th... — committed to oss-review-toolkit/ort by fviernau a year ago
- fix(GoMod): Fix analyzing `go.mod` files with unused dependencies The implementation uses `go list` to retrieve a list of `ModuleInfo`s. A `ModuleInfo` has a property named `GoMod` which points to th... — committed to oss-review-toolkit/ort by fviernau a year ago
- fix(GoMod): Fix analyzing `go.mod` files with unused dependencies The implementation uses `go list` to retrieve a list of `ModuleInfo`s. A `ModuleInfo` has a property named `GoMod` which points to th... — committed to oss-review-toolkit/ort by fviernau a year ago
Hey @fviernau, here is our example project that produces this error (Note: the Go code itself does not work, but contains the necessary dependencies ๐).
example-project-missing-gomod-field.zip
What I did to test this:
For our project these dependencies seem to be missing the
GoModfield:Apparently they are all indirect dependencies used by
github.com/aws/aws-go-lambda- because once you remove it the issue can no longer be reproduced (see the comment in themain.go).To reproduce the error inside ORT I used revision
d949be19c1c99f8abd07d30bbe5d2ce480744bed(released 2023-03-06 11:06 PM GMT+1). Running theanalyzephase then produces this error:If there is anything else I can provide then please let me know.
Thanks a lot @fviernau (and everybody else who reviewed the PRs and shared their thoughts)!
I just re-tested this issue running revision 314c95804246f2b668a2eb8ce046590b9216af84 (released 2023-03-13 10:01 PM GMT+1) and the issue does no longer occur - neither for the small reproduction project nor for our main project ๐
Awsome @malmor this was very helpful. Iโve just tested my 2 open PRs against your example and it seems to work now. It also works against the
go.modfile` described in the ticket description.Please not here. If you encounter a new issue like a regression in runtime, please open a new issue.
Thanks!
Thanks @fviernau - looking forward to testing the new version once itโs released!
Note: when analyzing the docker package ORT shows no dependencies of docker.