Description
The code generated doesn't compile, with the following error message:
go/api_silly_api.go:65:50: undefined: errors
go/api_silly_api.go:65:65: undefined: io
openapi-generator version
7.6.0
7.7.0
8.0.0-20240527.073301-5
They all exhibit the same behaviour.
OpenAPI declaration file content or url
https://gist.github.com/Andrei-Errapart/8a7eeaf6744aad7409a054df6f7fc398
Generation Details
All default options.
Steps to reproduce
rm -rf sillyserver
mkdir -p sillyserver
java -jar $jar generate -i api-1.0.1.yaml -g go-server --output sillyserver || exit $?
cd sillyserver
go get || exit $?
go build . || exit $?
Related issues/PRs
#8847
Perhaps the same trick can be employed here: simply assign unused imports
Suggest a fix
Here is one recommendation: #8847 possible fix
The idea is to use to mark the imports as used and generate them always:
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto .Marshal
var _ = fmt .Errorf
var _ = math .Inf 👍 React with 👍 6RobQuistNL, nag0yan, akosel, guscott, longergrass and 1 more