From dev-return-2694-archive-asf-public=cust-asf.ponee.io@openwhisk.apache.org Mon Oct 1 12:36:48 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 71F9D180660 for ; Mon, 1 Oct 2018 12:36:47 +0200 (CEST) Received: (qmail 18815 invoked by uid 500); 1 Oct 2018 10:36:46 -0000 Mailing-List: contact dev-help@openwhisk.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwhisk.apache.org Delivered-To: mailing list dev@openwhisk.apache.org Received: (qmail 18802 invoked by uid 99); 1 Oct 2018 10:36:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2018 10:36:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 4C540180B92 for ; Mon, 1 Oct 2018 10:36:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.702 X-Spam-Level: X-Spam-Status: No, score=-0.702 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=messagingengine.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id G5PVETEKYt9A for ; Mon, 1 Oct 2018 10:36:43 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 014255F530 for ; Mon, 1 Oct 2018 10:36:42 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id F0AE221DB2 for ; Mon, 1 Oct 2018 06:36:35 -0400 (EDT) Received: from web6 ([10.202.2.216]) by compute2.internal (MEProxy); Mon, 01 Oct 2018 06:36:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ywCHh4 qvjLEjr5Mgfx9kqDEM58HTBlBC+83y0L4o2No=; b=DQC2Zyw04/I8VEddnTjPyW 3GRzFFIrSAkVVyDwm1LSSc86kify6CCko6VyIcznQG4drNCmGKFyj70S8i3KxpL6 iwdxCJjQ4t6Yh1Zs+7cbmRLrMSIZDSO7J4NEYiWUWjWBscpN649y/pShQ6Ph3zSt FkYayQeIPgdgo5tBm0JBdv25lt9/fOtXO44C1oLx0pqvDhCRPM+6FFA66rDpMQEn XBcNzGnGOwrCXW5oUrdjc/EK2FewhI8dgJzRAgynax7zCk19b+b8uZ7VeaJg5eMG fXGNNpIb+C99pE76qAu9Hrm+Ss7LxqZbA3d/3Ot3rScY/2SKK+OAsIMyqm2/Ffuw == X-ME-Sender: X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 99) id 914FE4211; Mon, 1 Oct 2018 06:36:35 -0400 (EDT) Message-Id: <1538390195.3903565.1526303312.352A5084@webmail.messagingengine.com> From: Michele Sciabarra To: dev@openwhisk.apache.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-27407983 Date: Mon, 01 Oct 2018 12:36:35 +0200 References: <1538208220.1386661.1524651800.42B780DE@webmail.messagingengine.com> In-Reply-To: Subject: Re: Interpretation of "main" for GoLang and ActionLoop docker images Yes the issues are there. But it is still confusing the current way it hand= les the main in a source zip. It requires you have a file named "main" (lower case) without .go extension= , ( while other files are WITH extension) and a main function that is calle= d Main (capitalized).=20 Too complex. I want to remove at all the "main" file requirement (not neces= sary) and use the name of the function to point the main function, whenever= it is.=20 --=20 Michele Sciabarra michele@sciabarra.com ----- Original message ----- From: Carlos Santana To: dev@openwhisk.apache.org Subject: Re: Interpretation of "main" for GoLang and ActionLoop docker imag= es Date: Sun, 30 Sep 2018 16:22:23 -0400 Michele, I have being using the runtime this week and looks very good. Based on my findings and as discuss in Slack I think all the changes are captured as issues in the repo, if any are missing please open issues to coordinate. In addition of having the compiler out of the box which I think is great, I think we need a docs on how to setup a local dev, like having a VSCode and have tests file that can run the function without having a main.main defined this was an area I was confuse since I usually have a main function to run my go code. =E2=80=94 Carlos On Sat, Sep 29, 2018 at 4:03 AM Michele Sciabarra wrote: > Hello all, > > I need to discuss my plan for simplifying rules for interpreting "main" > for Golang. > > The rules I have used for interpreting the "main" parameter in wsk turned > out to be a bit confusing, so I plan to make them simpler. This is what I > plan to implement, please confirm it is fine OR tell me if there is > something I should change. The text below will go in documentation if it = is > ok. > > ---- > > There are 4 cases to send input to the runtime: > > 1. Sending a precompiled binary, specifying a main function > 2. Sending a zip file including a binary > 3. Sending a single source file > 4. Sending a zip file with multiple sources. > > Case 1: Sending a precompiled binary, specifying the main function > In this case, the main function will be ignored. > > Case 2: sending zip file including a precompiled binary > In this case, the main function will be the name of the file in the zip > > Case 3: sending a source action > > In this case, the main function will point to the CAPITALIZED function in > package main. > I need this capitalization because in Go I cannot use main.main because it > is reserved and I use it for the bootstrap code. > > Example: -main "main" =3D> Main function is "main.Main", > -main hello, main function will be "main.Hello". > Also if I use -main Hello it will be "main.Hello". > > Case4: sending a zip with source actions. Here is where the current rules > turned out to be very confusing. So I am going to simplify this way: > > You can upload all the files you want in your zip file, they must all have > .go extension and they will be compiled. You must NOT have a main.main > function as this will be provided by the runtime. The name of the main > function will be interpreted as in 3: -main main (or default) =3D> main.M= ain > , -main hello =3D> main.Hello > > Compiler: > > The go runtime provides also a compiler to "precompile" the actions. > Using the compiler you can run the actions with just the generic > "actionloop" container, smaller since there is no go compiler in it > > The compiler must be fed either a source file as in Case 3 or a zip file > conforming the Case 4 and will always produce a ZIP file containing a > binary according to case 2. > > So it will be somewhat like this: > > To compile: > > zip - -r * | docker -i openwhisk/actionloop-golang-v1.11 -compile main > >main.zip > > this will compile the sources expecting a main.Main function and will > produce a zip file with a main. > > This can be deployed with: > > wsk update action golang-action main.zip -docker opewhisk/actionloop > > Example using a different name: > > If you want to use "hello" you can use: > > zip - -r * | docker -i openwhisk/actionloop-golang-v1.11 -compile hello > >hello.zip > > This will look for a function main.Hello in the sources, and will produce > a zip file with a hello file. > > This will have to be deployed as: > > wsk update action golang-action hello.zip -main hello -docker > opewhisk/actionloop > > --- > > Thoughts? > > > > > > -- > Michele Sciabarra > michele@sciabarra.com > --=20 Carlos Santana