Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #4083
Closed
Open
Issue created Oct 07, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG] [GO] 1.13 invalid go.mod

Created by: 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=
Assignee
Assign to
Time tracking