Skip to content

[BUG] [GO] 1.13 invalid go.mod #4083

@urandom2

Description

@urandom2

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

The openapi-generator-cli currently creates an invalid go.mod file, according to the go1.13.1 compiler.

openapi-generator version

4.2.0-SNAPSHOT

OpenAPI declaration file content or url

petstore.yaml

Command line used for generation
openapi-generator-cli generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g go -o /local/out/go
Steps to reproduce
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g go -o /local/out/go
cd out/go
go mod tidy
go: github.com/antihax/optional@v0.0.0-20180406194304-ca021399b1a6: invalid pseudo-version: does not match version-control timestamp (2018-04-07T02:43:04Z)
Related issues/PRs

I was unable to find anything similar: query.

Suggest a fix

It looks like #2813 bound the two pseudo versions listed in go.mod. I can submit a change to correct it to the following:

4,5c6,7
<     github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6
<     golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
---
>       github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6
>       golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a

It also looks like your go.sum is missing one or more hashes:

2c2,4
< github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
---
> github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6 h1:uZuxRZCz65cG1o6K/xUqImNcYKtmk9ylqaH0itMSvzA=
> github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
> github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
8a11
> golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
10a14
> google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions