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
  • #14448
Closed
Open
Issue created Jan 13, 2023 by Administrator@rootContributor

[BUG][GO] Generated API Imports Deprecated io/ioutil Package

Created by: gonzogomez

Description

The generator will generate the following go code with the deprecated io/ioutil package:

import (
        "bytes"
        "context"
        "io/ioutil"
        "net/http"
        "net/url"
        "strings"
        "os"
)

io/ioutil package has been deprecated as of Go 1.16, the same functionality is now provided by the io and os packages.

openapi-generator version

Version tested :

  • 6.2.1
  • master
OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Command line used for generation

./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g go -o /gen/out/go-petstore -p packageName=petstore

Steps to reproduce

Generate the go code with petstore.yaml ./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g go -o /gen/out/go-petstore -p packageName=petstore

Suggest a fix/enhancement

Modify the following mustache template files to use io and os instead of io/ioutil

  • api.ustache
  • client.mustache
  • signing.mustache
Assignee
Assign to
Time tracking