You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/11/07 21:32:54 UTC

[GitHub] csantanapr closed pull request #344: updates to the website for Go Actions

csantanapr closed pull request #344: updates to the website for Go Actions
URL: https://github.com/apache/incubator-openwhisk-website/pull/344
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/_includes/code/hello.go b/_includes/code/hello.go
index 149c22b..aa63017 100644
--- a/_includes/code/hello.go
+++ b/_includes/code/hello.go
@@ -1,25 +1,15 @@
 package main
 
-import "encoding/json"
 import "fmt"
-import "os"
 
-func main() {
-    //program receives one argument: the JSON object as a string
-    arg := os.Args[1]
-
-    // unmarshal the string to a JSON object
-    var obj map[string]interface{}
-    json.Unmarshal([]byte(arg), &obj)
-
-    // can optionally log to stdout (or stderr)
-    fmt.Println("hello Go action")
-
-    name, ok := obj["name"].(string)
-    if !ok { name = "Stranger" }
-
-    // last line of stdout is the result JSON object as a string
-    msg := map[string]string{"msg": ("Hello, " + name + "!")}
-    res, _ := json.Marshal(msg)
-    fmt.Println(string(res))
+// Main function for the action
+func Main(obj map[string]interface{}) map[string]interface{} {
+	name, ok := obj["name"].(string)
+	if !ok {
+		name = "stranger"
+	}
+	fmt.Printf("name=%s\n", name)
+	msg := make(map[string]interface{})
+	msg["msg"] = "Hello, " + name + "!"
+	return msg
 }
diff --git a/_includes/code/manifest-for-helloGo.yaml b/_includes/code/manifest-for-helloGo.yaml
index ae475fe..9b7f79e 100644
--- a/_includes/code/manifest-for-helloGo.yaml
+++ b/_includes/code/manifest-for-helloGo.yaml
@@ -2,5 +2,4 @@ packages:
     default:
         actions:
             helloGo:
-                function: actions/
-                native: true
+                function: hello.go
diff --git a/_layouts/documentation.html b/_layouts/documentation.html
index 7afb146..d2c9d26 100644
--- a/_layouts/documentation.html
+++ b/_layouts/documentation.html
@@ -1097,22 +1097,13 @@ <h5>Creating And Invoking Go actions</h5>
                         <div class="terminal">
 {% highlight go linenos %}
 {% include code/hello.go %}
-{% endhighlight %}
-                        </div>
-                    </li>
-                    <li style="list-style-type: decimal">
-                        Create an executable called <i>exec</i> using <i>hello.go</i>:
-                        <div class="terminal">
-{% highlight bash %}
-$ GOOS=linux GOARCH=amd64 go build -o exec
-$ zip exec.zip exec
 {% endhighlight %}
                         </div>
                     </li>
                     <li style="list-style-type: decimal">
                         Create an action <i>helloGo</i>:
                         <div class="terminal">
-{% highlight bash %}$ wsk action create helloGo --native exec.zip{% endhighlight %}
+{% highlight bash %}$ wsk action create helloGo hello.go{% endhighlight %}
                         </div>
                     </li>
                     <li style="list-style-type: decimal">
@@ -1136,15 +1127,6 @@ <h5>Creating And Invoking Go actions</h5>
                         </p>
                         <ol>
                             <li>Create a directory called <i>actions</i> with <i>hello.go</i> from step 1 <a href="#hello-go">above</a>.</li>
-                            <li>
-                                Create an executable called <i>exec</i> using <i>hello.go</i>:
-                                <div class="terminal">
-{% highlight bash %}
-$ cd actions/
-$ GOOS=linux GOARCH=amd64 go build -o exec
-{% endhighlight %}
-                                </div>
-                            </li>
                             <li>
                                 Create <i>manifest.yaml</i> with the following YAML content:
                                 <div class="terminal">
@@ -1172,8 +1154,8 @@ <h5>OpenWhisk Runtime for Go</h5>
                 <a class="indexable" id="go-additional-resources"></a>
                 <h5>Additional Resources</h5>
                 <ul>
-                    <li><a href="http://jamesthom.as/blog/2017/01/17/openwhisk-and-go/">Running Go Binaries on OpenWhisk</a></li>
                     <li><a href="https://www.slideshare.net/MicheleSciabarr/openwhisk-go-runtime">OpenWhisk Go Runtime</a></li>
+                    <li><a href="https://www.slideshare.net/MicheleSciabarr/openwhisk-goswiftbinaries-runtime">ActionLoop, Go and Swift</a></li>                   
                 </ul>
             </div>
         </main>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services