daria-malkova commented on a change in pull request #16273:
URL: https://github.com/apache/beam/pull/16273#discussion_r771490006



##########
File path: playground/backend/internal/preparators/go_preparators.go
##########
@@ -51,16 +54,15 @@ func formatCode(args ...interface{}) error {
        return nil
 }
 
-func changeFileName(args ...interface{}) error {
+func changeGoTestFileName(args ...interface{}) error {
        filePath := args[0].(string)
-       isUnitTest := args[1].(bool)
-       if isUnitTest {
+       validationResults := args[1].(*sync.Map)
+       isUnitTest, ok := 
validationResults.Load(validators.UnitTestValidatorName)
+       if ok && isUnitTest.(bool) {
                testFileName := fmt.Sprintf("%s_test.%s", 
strings.Split(filePath, sep)[0], goName)
-               cmd := exec.Command(mvCmd, filePath, testFileName)
-               fmt.Println(cmd.String())
-               stdout, err := cmd.CombinedOutput()
+               err := os.Rename(filePath, testFileName)
                if err != nil {
-                       return errors.New(string(stdout))
+                       return err

Review comment:
       Why? We return error form preparator and this will be proccesed later

##########
File path: playground/backend/internal/preparators/go_preparators.go
##########
@@ -51,16 +54,15 @@ func formatCode(args ...interface{}) error {
        return nil
 }
 
-func changeFileName(args ...interface{}) error {
+func changeGoTestFileName(args ...interface{}) error {
        filePath := args[0].(string)
-       isUnitTest := args[1].(bool)
-       if isUnitTest {
+       validationResults := args[1].(*sync.Map)
+       isUnitTest, ok := 
validationResults.Load(validators.UnitTestValidatorName)
+       if ok && isUnitTest.(bool) {
                testFileName := fmt.Sprintf("%s_test.%s", 
strings.Split(filePath, sep)[0], goName)
-               cmd := exec.Command(mvCmd, filePath, testFileName)
-               fmt.Println(cmd.String())
-               stdout, err := cmd.CombinedOutput()
+               err := os.Rename(filePath, testFileName)
                if err != nil {
-                       return errors.New(string(stdout))
+                       return err

Review comment:
       Why? We return error from preparator and this will be proccessed later




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to