fix NPE in go generator (#3104)

This commit is contained in:
William Cheng 2019-06-06 01:57:16 +08:00 committed by GitHub
parent 6379022c42
commit 86e53d6f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 5 deletions

View File

@ -51,6 +51,7 @@ declare -a scripts=(
"./bin/csharp-netcore-petstore-all.sh"
"./bin/elixir-petstore.sh"
"./bin/go-petstore.sh"
"./bin/go-petstore-withxml.sh"
"./bin/go-gin-petstore-server.sh"
"./bin/groovy-petstore.sh"
"./bin/apex-petstore.sh"

View File

@ -114,7 +114,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
}
}
if (additionalProperties.containsKey(WITH_GO_CODEGEN_COMMENT)) {
if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) {
setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString()));
if (isGoSubmodule) {
additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true");

View File

@ -1 +1 @@
4.0.1-SNAPSHOT
4.0.2-SNAPSHOT

View File

@ -388,7 +388,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e
} else if jsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
xml.NewEncoder(bodyBuf).Encode(body)
err = xml.NewEncoder(bodyBuf).Encode(body)
}
if err != nil {

View File

@ -59,7 +59,7 @@ Creates list of users with given input array
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**[]User**](array.md)| List of user object |
**body** | [**[]User**](User.md)| List of user object |
### Return type
@ -90,7 +90,7 @@ Creates list of users with given input array
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**[]User**](array.md)| List of user object |
**body** | [**[]User**](User.md)| List of user object |
### Return type