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

promu build does not work on Windows #44

Closed
carlpett opened this issue Sep 17, 2016 · 3 comments
Closed

promu build does not work on Windows #44

carlpett opened this issue Sep 17, 2016 · 3 comments

Comments

@carlpett
Copy link
Member

I'm trying to use promu for wmi_exporter and ran into some issues on Windows. I have some fixes coming in a pull request, but here is a list of the things I've noticed so far:

  • The user part of the build info is mangled in ldflags, this is what it looks like on my machine -X github.com /m@MY-HOST
  • The go-shell package does not report panics in any way, but instead simply swallows any errors. Unsure if this is a bug in the package or the use of it (defer shell.ErrExit())
  • The default shell is /bin/sh, which does not exist on Windows, and causes a panic (which as mentioned is swallowed, and promu exits with status code 0)

Is Windows compatibility a goal of promu? I have a patch which fixes the first item, but from some experimentation with go-shell, it seems a bit hard to make it work on Windows. Will try some more, but if it is a non-goal for this project, I'll just have to use something else.

@carlpett
Copy link
Member Author

Go-shell does some management of argument quoting internally it seems, after which Go (on Windows only) applies some rules of its own (https://github.com/golang/go/blob/master/src/syscall/exec_windows.go#L17). The effect is that the ldflags parameter has its quotes escaped, which turns the call into go build [...] -ldflags "\"-s" -X[...]. Might be possible to work around, somehow

@sdurrheimer
Copy link
Contributor

To be honest, I never really thought about Windows when I was doing promu, so I'm not surprised we got some issues here.

I would totally merge Windows compatibility PRs, if we are able to make it work.

I will also take a look on my side to see if I can improve those things.

@carlpett
Copy link
Member Author

@sdurrheimer Cool! I think the main culprit is go-shell, really. I'll give fixing it a try (probably just providing another code path if running on Windows).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants