fix: Use correct binary path on Windows#231
Conversation
yevgenypats
left a comment
There was a problem hiding this comment.
I think on the save side let's make it consistent without suffix
| } | ||
| org, name := pathSplit[0], pathSplit[1] | ||
| localPath := filepath.Join(c.directory, "plugins", string(PluginTypeDestination), org, name, version, "plugin") | ||
| localPath = withBinarySuffix(localPath) |
There was a problem hiding this comment.
I don't think we should save it with .exe (I get the goreleaser part but no need to do it on the save part as it will work without the exe)
There was a problem hiding this comment.
See PR description, it doesn't work without it as the go code looks for the extension:
https://github.com/golang/go/blob/f6d844510d5f1e3b3098eba255d9b633d45eac3b/src/os/exec/lp_windows.go#L39
See failure https://github.com/cloudquery/cloudquery/actions/runs/3173117211/jobs/5168369062#step:7:9

| } | ||
| org, name := pathSplit[0], pathSplit[1] | ||
| localPath := filepath.Join(c.directory, "plugins", string(PluginTypeSource), org, name, version, "plugin") | ||
| localPath = withBinarySuffix(localPath) |
| if runtime.GOOS == "windows" { | ||
| pathInArchive += ".exe" | ||
| } | ||
| pathInArchive = withBinarySuffix(pathInArchive) |
There was a problem hiding this comment.
I think we just needed it here so no need to do withBinarySuffix
There was a problem hiding this comment.
We already have it here and it still fails (see failure in other comment)
🤖 I have created a release *beep* *boop* --- ## [0.11.7](v0.11.6...v0.11.7) (2022-10-03) ### Bug Fixes * Set default download directory to `.cq` ([#230](#230)) ([689f5ed](689f5ed)) * Use correct binary path on Windows ([#231](#231)) ([0a5dc26](0a5dc26)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Based on
gosource code binaries on Windows must end inexe,cmd, etc. See https://github.com/golang/go/blob/f6d844510d5f1e3b3098eba255d9b633d45eac3b/src/os/exec/lp_windows.go#L39⬆️ Is the code that looks up the binary when you use the
execpackageUse the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)