mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-17 14:29:12 +00:00
[Golang][client] fix file suffix for _test.go (#449)
* add file suffix fix for _test.go * Trigger CI due to previous Shippable race condition * Trigger CI due to previous Shippable race condition * Trigger CI due to previous Travis CI stall * Trigger CI due to previous Travis CI stall * Trigger CI due to previous Shippable race condition * add Go client test testFilenames
This commit is contained in:
@@ -201,7 +201,12 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
return toModel("model_" + name);
|
||||
name = toModel("model_" + name);
|
||||
if (name.endsWith("_test")) {
|
||||
LOGGER.warn(name + ".go with `_test.go` suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
|
||||
name += "_";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toModel(String name) {
|
||||
@@ -237,7 +242,12 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
|
||||
// e.g. PetApi.go => pet_api.go
|
||||
return "api_" + underscore(name);
|
||||
name = "api_" + underscore(name);
|
||||
if (name.endsWith("_test")) {
|
||||
LOGGER.warn(name + ".go with `_test.go` suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
|
||||
name += "_";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user