[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:
John Wang
2018-07-04 23:02:10 -07:00
committed by William Cheng
parent 8fb413107c
commit 33fcd28dba
14 changed files with 29 additions and 93 deletions

View File

@@ -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