Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows go rework #5816

Merged
merged 2 commits into from Feb 11, 2019

Conversation

Projects
None yet
4 participants
@dschep
Copy link
Member

dschep commented Feb 8, 2019

I failed to properly test it after a slight refactor befor emerge

fix windows go rework.
I failed to properly test it after a slight refactor befor emerge

@dschep dschep requested a review from sebito91 Feb 8, 2019

@sebito91
Copy link
Member

sebito91 left a comment

LGTM

@lolcoolkat

This comment has been minimized.

Copy link

lolcoolkat commented Feb 9, 2019

@dschep I've tested the new code that's been added. However i'm still getting the {"message": "Internal server error"} after deploying a hello world function. Any ideas? :/ Here's a screengrab of the zip process with the file name and the new mode on the binaries (I added a console log to see the file names and modes that were getting zipped)

img
https://tllhnhc8s6.execute-api.us-east-1.amazonaws.com/dev/world

Logs
error

Note: Don't mind the auth function.. it only affects the hello function. I'm testing the world function!

@pmuens pmuens added the pr/in-review label Feb 10, 2019

@pmuens

pmuens approved these changes Feb 11, 2019

Copy link
Member

pmuens left a comment

This looks good from a code perspective.

I haven't tested it and it looks like @lolcoolkat runs into some issues. Based on the implementation it should be good to go...

@pmuens pmuens changed the title fix windows go rework. Fix windows go rework. Feb 11, 2019

@pmuens pmuens changed the title Fix windows go rework. Fix windows go rework Feb 11, 2019

@dschep dschep merged commit 0a024e2 into master Feb 11, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dschep dschep deleted the win-go branch Feb 11, 2019

@dschep

This comment has been minimized.

Copy link
Member Author

dschep commented Feb 11, 2019

hmm. odd @lolcoolkat, this is how it worked for me:

User@WinDev1811Eval MINGW64 ~
$ npm i -g serverless/serverless &> /dev/null

User@WinDev1811Eval MINGW64 ~
$ sls create -t aws-go -p aws-go
Serverless: Generating boilerplate...
Serverless: Generating boilerplate in "C:\Users\User\aws-go"
 _______                             __
|   _   .-----.----.--.--.-----.----|  .-----.-----.-----.
|   |___|  -__|   _|  |  |  -__|   _|  |  -__|__ --|__ --|
|____   |_____|__|  \___/|_____|__| |__|_____|_____|_____|
|   |   |             The Serverless Application Framework
|       |                           serverless.com, v1.37.0
 -------'

Serverless: Successfully generated boilerplate for template: "aws-go"

User@WinDev1811Eval MINGW64 ~
$ cd aws-go

User@WinDev1811Eval MINGW64 ~/aws-go
$ make
env GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
env GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go

User@WinDev1811Eval MINGW64 ~/aws-go
$ sls deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service aws-go.zip file to S3 (10.8 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
....................
Serverless: Stack update finished...
Service Information
service: aws-go
stage: dev
region: us-east-1
stack: aws-go-dev
resources: 16
api keys:
  None
endpoints:
  GET - https://089sn4eo5f.execute-api.us-east-1.amazonaws.com/dev/hello
  GET - https://089sn4eo5f.execute-api.us-east-1.amazonaws.com/dev/world
functions:
  hello: aws-go-dev-hello
  world: aws-go-dev-world
layers:
  None
Serverless: Removing old service artifacts from S3...

image

@lolcoolkat

This comment has been minimized.

Copy link

lolcoolkat commented Feb 12, 2019

I'm not using MINGW64 @dschep so i'm not sure if the process is different. I'm just using normal Windows10 along with Command Prompt. So that process you have in the make file doesn't work with command prompt. I have the following:

Makefile

build:
    set GOOS=linux
    go build -ldflags="-s -w" -o bin/hello hello/main.go
    go build -ldflags="-s -w" -o bin/world world/main.go

And then I do sls deploy and I get an error. Maybe its something to do with the make process not being correct? Do you mind trying your process on a Windows10 machine and just use regular Command Prompt (cmd) to deploy and see if u get the same thing?

@dschep

This comment has been minimized.

Copy link
Member Author

dschep commented Feb 12, 2019

@lolcoolkat set GOOS=linux doesn't seem to be working. I ran that Makefile in cmd and then ran file bin/world in my bash shell and it says it's an MSDOS binary.

@lolcoolkat

This comment has been minimized.

Copy link

lolcoolkat commented Feb 12, 2019

Oh, okay maybe that’s my issue then. Any ideas for a work around just using cmd? I’m assuming ill need to use MINGW64 like you did?

@dschep

This comment has been minimized.

Copy link
Member Author

dschep commented Feb 12, 2019

@lolcoolkat I figured out how to get it to work. in cmd run:

set GOOS=linux
make
@lolcoolkat

This comment has been minimized.

Copy link

lolcoolkat commented Feb 12, 2019

That worked @dschep thank you!!!!! <3

@lolcoolkat

This comment has been minimized.

Copy link

lolcoolkat commented Feb 12, 2019

@dschep figured out how to do it in the Makefile btw :) Just had to add quotes!

build:
	set "GOOS=linux" && go build -ldflags="-s -w" -o bin/hello hello/main.go
	set "GOOS=linux" && go build -ldflags="-s -w" -o bin/world world/main.go

Note: Adding set "GOOS=linux" as the first command in build didn't seem to work. I needed to add it to every build line.

🎉 🎉 🎉 🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.