You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:47:40 UTC

[GitHub] [dubbo-go-hessian2] wongoo opened a new pull request #213: support test golang encoding data in java

wongoo opened a new pull request #213:
URL: https://github.com/apache/dubbo-go-hessian2/pull/213


   
   **What this PR does**:
   support test golang encoding data in java
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] AlexStocks commented on a change in pull request #213: support test golang encoding data in java

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #213:
URL: https://github.com/apache/dubbo-go-hessian2/pull/213#discussion_r462365771



##########
File path: output/output.go
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+
+	"github.com/apache/dubbo-go-hessian2/output/testfuncs"

Review comment:
       split this import block.

##########
File path: output/output.go
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+
+	"github.com/apache/dubbo-go-hessian2/output/testfuncs"
+)
+
+type outputFunc func() []byte
+
+var (
+	funcName = flag.String("func_name", "", "func name")
+	funcMap  = make(map[string]outputFunc)

Review comment:
       pls set its init length,
   
   funcMap = make(map[string]outputFunc, 8)

##########
File path: output/output.go
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+
+	"github.com/apache/dubbo-go-hessian2/output/testfuncs"
+)
+
+type outputFunc func() []byte
+
+var (
+	funcName = flag.String("func_name", "", "func name")
+	funcMap  = make(map[string]outputFunc)
+)
+
+// add all output func here
+func init() {
+	funcMap["HelloWorldString"] = testfuncs.HelloWorldString
+}
+
+func main() {
+	flag.Parse()
+
+	if *funcName == "" {
+		_, _ = fmt.Fprintln(os.Stderr, "func name required")
+		os.Exit(1)
+	}
+	f, exist := funcMap[*funcName]
+	if !exist {
+		_, _ = fmt.Fprintln(os.Stderr, "func name not exist: ", *funcName)
+		os.Exit(1)
+	}
+
+	defer func() {
+		if err := recover(); err != nil {
+			_, _ = fmt.Fprintln(os.Stderr, "error: ", err)
+			os.Exit(1)
+		}
+	}()
+	if _, err := os.Stdout.Write(f()); err != nil {
+		_, _ = fmt.Fprintln(os.Stderr, "call error: ", err)
+		os.Exit(1)

Review comment:
       using return instead.

##########
File path: output/output.go
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+
+	"github.com/apache/dubbo-go-hessian2/output/testfuncs"
+)
+
+type outputFunc func() []byte
+
+var (
+	funcName = flag.String("func_name", "", "func name")
+	funcMap  = make(map[string]outputFunc)
+)
+
+// add all output func here
+func init() {
+	funcMap["HelloWorldString"] = testfuncs.HelloWorldString
+}
+
+func main() {
+	flag.Parse()
+
+	if *funcName == "" {
+		_, _ = fmt.Fprintln(os.Stderr, "func name required")
+		os.Exit(1)
+	}
+	f, exist := funcMap[*funcName]
+	if !exist {
+		_, _ = fmt.Fprintln(os.Stderr, "func name not exist: ", *funcName)
+		os.Exit(1)
+	}
+
+	defer func() {
+		if err := recover(); err != nil {
+			_, _ = fmt.Fprintln(os.Stderr, "error: ", err)
+			os.Exit(1)
+		}
+	}()
+	if _, err := os.Stdout.Write(f()); err != nil {
+		_, _ = fmt.Fprintln(os.Stderr, "call error: ", err)
+		os.Exit(1)
+	}
+	os.Exit(0)

Review comment:
       using return instead.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] AlexStocks merged pull request #213: support test golang encoding data in java

Posted by GitBox <gi...@apache.org>.
AlexStocks merged pull request #213:
URL: https://github.com/apache/dubbo-go-hessian2/pull/213


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go-hessian2] wongoo commented on a change in pull request #213: support test golang encoding data in java

Posted by GitBox <gi...@apache.org>.
wongoo commented on a change in pull request #213:
URL: https://github.com/apache/dubbo-go-hessian2/pull/213#discussion_r462672131



##########
File path: output/output.go
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+
+	"github.com/apache/dubbo-go-hessian2/output/testfuncs"
+)
+
+type outputFunc func() []byte
+
+var (
+	funcName = flag.String("func_name", "", "func name")
+	funcMap  = make(map[string]outputFunc)
+)
+
+// add all output func here
+func init() {
+	funcMap["HelloWorldString"] = testfuncs.HelloWorldString
+}
+
+func main() {
+	flag.Parse()
+
+	if *funcName == "" {
+		_, _ = fmt.Fprintln(os.Stderr, "func name required")
+		os.Exit(1)
+	}
+	f, exist := funcMap[*funcName]
+	if !exist {
+		_, _ = fmt.Fprintln(os.Stderr, "func name not exist: ", *funcName)
+		os.Exit(1)
+	}
+
+	defer func() {
+		if err := recover(); err != nil {
+			_, _ = fmt.Fprintln(os.Stderr, "error: ", err)
+			os.Exit(1)
+		}
+	}()
+	if _, err := os.Stdout.Write(f()); err != nil {
+		_, _ = fmt.Fprintln(os.Stderr, "call error: ", err)
+		os.Exit(1)

Review comment:
       @AlexStocks  main func not support return value




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org