[Go][Experimental] Avoid duplicated import in enum model (#6355)

* avoid double import of fmt

* update go exp petstore oas3

* import for go client exp only
This commit is contained in:
William Cheng 2020-05-19 20:17:45 +08:00 committed by GitHub
parent 2f9aa282e5
commit 096b8f8828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 4 additions and 25 deletions

View File

@ -641,6 +641,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
} }
} }
if (this instanceof GoClientExperimentalCodegen && model.isEnum) {
imports.add(createMapping("import", "fmt"));
}
// if oneOf contains "null" type // if oneOf contains "null" type
if (model.oneOf != null && !model.oneOf.isEmpty() && model.oneOf.contains("nil")) { if (model.oneOf != null && !model.oneOf.isEmpty() && model.oneOf.contains("nil")) {
model.isNullable = true; model.isNullable = true;

View File

@ -1,7 +1,3 @@
import (
"fmt"
)
// {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}} // {{{classname}}} {{#description}}{{{.}}}{{/description}}{{^description}}the model '{{{classname}}}'{{/description}}
type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}}

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )

View File

@ -11,9 +11,6 @@ package petstore
import ( import (
"encoding/json" "encoding/json"
)
import (
"fmt" "fmt"
) )