Closed ccp-ccollins closed 7 years ago
Hi @ccp-ccollins,
Sorry for my late answer and thank you very much for spending your time on this issue.
As you've noticed we didn't really care about the windows case and wait for windows users to come with their use cases. The project is very linux/mac oriented and windows wasn't our first target.
But as you are here now, we will try to improve the windows usability :wink:
Can you please fork the project and submit a pull request so we can work together on this issue. There are some points to consider:
The project aims to provide the most general and non idiomatic way to build a Lambda so that each user can specialize the provided build scripts/example for his own needs. Also, I think we should provide a powershell script that is more generic without assumptions like team, cloud, etc.
We should rather replace \
by /
more broadly and drives like C:\
by /C/
or something like that, and as the maintainer of the Docker image we can also be sure that such paths won't be used internally.
We should also rename build.ps1
to make.ps1.example
, so that in the README we can have a very similar build process for Windows users, i.e. download the example build scripts and run make
(to run the powershell script one can type the script's name with or without the .ps1 extension).
Here are some remarks and I remain open to any kind of modification as you are the real end user :wink:
One more time, thank you very much for your time and for having opened this issue.
The next few days will be busy for me with other tasks, but I should be able to pick up some of this after that.
@fsenart What about adding OS detection to the makefile and then customizing it to support Windows? I spent a decent amount of time this morning getting this to work on Windows and I don't think it'd be too much extra trouble to add Windows support. If that works for you I'll work on the Makefile and then submit a PR
@harrisonhjones thank you so much for your investigations and yeah for sure your PR is very welcome. Can you please verify that multiple GOPATHs work also on windows and that the final Makefile is still as generic as possible so that one can specialize it for his very own needs. And one more thing, one has to have GNU Make installed on windows, isn't it? With something like Cygwin or is there any standalone exe? In general can you also provide the needed prerequisites.
Leaving this just for posterity/curiosity; I'm using Git Bash on Windows and getting the shim to build indeed required using cygwin make and adding
docker: export MSYS_NO_PATHCONV=1
to the Makefile (or otherwise putting it to the environment before docker is ran) as otherwise cygwin tries its magic on the path before passing it on to docker which causes issues (see docker/toolbox#282).. After that, everything builds without a hitch on the shim part, Docker on Windows still has some issues.
Interested to see the PR, @harrisonhjones - glad to test it out for you when you get around to it!
Just tested with straight-up command prompt and cygwin make (with dependencies!) downloaded from here:
http://gnuwin32.sourceforge.net/packages/make.htm
Works great with the standard makefile, although can't guarantee it's not because of something else in my environment. Then I noticed that I'm a bit outdated on the makefile front and still using one without the multiple gopath support; so that part is untested and probably doesn't work - the separator looks to be different on windows but hardcoded into the makefile?
@moitias we've updated the Makefile based on #25 with 37dda5f in order to allow multiple GOPATHs. But as stated by @ccp-ccollins our update does not work on windows because we do strong assumptions on top of the path system and thus the new Makefile is very specialized for Linux users :disappointed:
Hi folks, my serverless-golang is based on this awesome library. I personally develop in windows and I believe my makefile is generic enough for both win and linux.
Hope this helps: https://github.com/yunspace/serverless-golang/blob/master/examples/aws-golang-event/Makefile
One thing to note is that the GOPATH needs to be set with / instead of \
Also I use PowerShell
It's now possible :wink:
I suppose you're not surprised, but even if one has GNU make for Windows installed, the Makefile still doesn't work on windows because 1) it assumes the path on the dev machine will be a valid path inside the container, and 2) it uses shell tricks that don't directly work on Windows.
To work around that, I created a powershell script that will do the "docker" step of the build. I am sharing it here and giving permission to edit or incorporate it at will, in the hopes that this will help other people. The functionality should be identical to the Makefile, except that it doesn't support multiple GOPATHs.
build.ps1