arr-ai / arrai

The ultimate data engine.
http://arr.ai
Apache License 2.0
20 stars 15 forks source link

The generated code does not keep consistent between windows and mac #574

Open jecofang01 opened 4 years ago

jecofang01 commented 4 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Description

The generated code does not keep consistent between windows and mac. Lots of unexpected leading space in the windows generated version. The leading space cause patching failure.

Steps to Reproduce

  1. generate code by https://github.com/anz-bank/sysl-go/blob/master/codegen/arrai/service.arrai

Expected behavior

The generated code keep consistent.

Actual behavior

--- dist/example.win.go 2020-08-13 17:05:34.000000000 +0800
+++ dist/example.mac.go 2020-08-13 17:05:33.000000000 +0800
@@ -1,39 +1,36 @@
+// Code generated by sysl DO NOT EDIT.
+package example

-        
-    // Code generated by sysl DO NOT EDIT.
-    package example
-
-    import (
-        "context"
-        "database/sql"
-        "encoding/json"
-        "fmt"
-        "strings"
-        "net/http"
-        "net/url"
-
-        "github.com/go-chi/chi"
-        "github.com/sirupsen/logrus"
-        "github.com/anz-bank/sysl-go/common"
-        "github.com/anz-bank/sysl-go/core"
-        "github.com/anz-bank/sysl-go/config"
-        "github.com/anz-bank/sysl-go/convert"
-        "github.com/anz-bank/sysl-go/database"
-        "github.com/anz-bank/sysl-go/handlerinitialiser"
-        "github.com/anz-bank/sysl-go/restlib"
-        "github.com/anz-bank/sysl-go/validator"
-        
-    )
-
-        // Reference imports to suppress unused errors
-        var _ = time.Parse
-
-        // Reference imports to suppress unused errors
-        var _ = date.Parse
-
-        
-                // GetExampleRequest ...
-                type GetExampleRequest struct {
-                    Field string `json:"field"`
-                    Operation string `json:"operation"`
-                }
+import (
+    "context"
+    "database/sql"
+    "encoding/json"
+    "fmt"
+    "strings"
+    "net/http"
+    "net/url"
+
+    "github.com/go-chi/chi"
+    "github.com/sirupsen/logrus"
+    "github.com/anz-bank/sysl-go/common"
+    "github.com/anz-bank/sysl-go/core"
+    "github.com/anz-bank/sysl-go/config"
+    "github.com/anz-bank/sysl-go/convert"
+    "github.com/anz-bank/sysl-go/database"
+    "github.com/anz-bank/sysl-go/handlerinitialiser"
+    "github.com/anz-bank/sysl-go/restlib"
+    "github.com/anz-bank/sysl-go/validator"
+    
+)
+
+// Reference imports to suppress unused errors
+var _ = time.Parse
+
+// Reference imports to suppress unused errors
+var _ = date.Parse
+
+// GetExampleRequest ...
+type GetExampleRequest struct {
+    Field string `json:"field"`
+    Operation string `json:"operation"`
+}

Your Environment

$ arrai info
Version    : v0.128.0
Git commit : 81f302899df339eaefb70f32c77a7ef1c74fc67d
Date       : 2020-08-10T11:33:14Z
OS/arch    : darwin/amd64
Go version : go1.14.7 linux/amd64
$ arrai info
Version    : v0.128.0
Git commit : 81f302899df339eaefb70f32c77a7ef1c74fc67d
Date       : 2020-08-10T11:33:27Z
OS/arch    : windows/amd64
Go version : go1.14.7 linux/amd64
anzdaddy commented 4 years ago

It looks like goimports isn't being run on the Windows build.

jecofang01 commented 4 years ago

The pasted code is raw output without calling gofmt, goimports tools.

ericzhang6222 commented 3 years ago

github workflow Windows OS make binary file is Chocolatey -> mingw64 -> mingw32-make.