ghdl
ghdl copied to clipboard
Binary name shall use `--name` flag with `.exe` extension
Current behavior
C:\Users\beet\Desktop\share\bin>ghdl caarlos0/tasktimer --name tt
→ start downloading tt_windows_amd64.tar.gz
███████████████████████████████████ 100% of 6.1 MB
→ binary file not found. Try to specify binary name flag
C:\Users\beet\Desktop\share\bin>ghdl caarlos0/tasktimer -n tt.exe
→ start downloading tt_windows_amd64.tar.gz
███████████████████████████████████ 100% of 6.1 MB
→ saved executable to C:\Users\beet\Desktop\share\bin\tt.exe
Related
https://github.com/beetcb/ghdl/blob/f53255a2ab0f2fae3f8018262f1a072b2e9cd521/ghdl/main.go#L44-L46
sweep: try this one
Here's the PR! https://github.com/beetcb/ghdl/pull/6.
⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 5 GPT-4 tickets left. For more GPT-4 tickets, visit our payment portal.To get Sweep to recreate this ticket, leave a comment prefixed with "sweep:" or edit the issue.
Step 1: 🔍 Code Search
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.
https://github.com/beetcb/ghdl/blob/11c9c7c5f10dca4102f8f55dc5d4501d519ad73c/README.md#L1-L95
https://github.com/beetcb/ghdl/blob/11c9c7c5f10dca4102f8f55dc5d4501d519ad73c/ghdl/main.go#L1-L108
https://github.com/beetcb/ghdl/blob/11c9c7c5f10dca4102f8f55dc5d4501d519ad73c/dl.go#L1-L178
https://github.com/beetcb/ghdl/blob/11c9c7c5f10dca4102f8f55dc5d4501d519ad73c/helper/sl/sl.go#L1-L80
https://github.com/beetcb/ghdl/blob/11c9c7c5f10dca4102f8f55dc5d4501d519ad73c/gh.go#L1-L146
Summaries of links found in the content:
https://github.com/beetcb/ghdl/blob/f53255a2ab0f2fae3f8018262f1a072b2e9cd521/ghdl/main.go#L44-L46:
The user is encountering an issue with the ghdl command. They are trying to download a binary file named tt but are getting an error message saying that the binary file is not found. They then try specifying the binary name flag as tt.exe and successfully download and save the executable file to a specific location. The user has provided a link to the relevant code in the GitHub repository.
Step 2: 🧐 Snippet Analysis
From looking through the relevant snippets, I decided to make the following modifications:
| File Path | Proposed Changes |
|---|---|
ghdl/main.go |
In the 'main' function, after retrieving the binary name flag, check if the operating system is Windows using 'runtime.GOOS'. If it is, check if the binary name ends with '.exe' using 'strings.HasSuffix'. If it doesn't, append '.exe' to the binary name. |
Step 3: 📝 Planning
I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:
Fix binary name issue on Windows
sweep/fix-binary-name-issue
Description
This PR fixes an issue where the binary name is not recognized on Windows systems when the '.exe' extension is missing. The current behavior is that the program fails to find the binary file and prompts the user to specify the binary name flag with the extension. This PR modifies the code to automatically append the '.exe' extension to the binary name if the operating system is Windows and the extension is not already present.
Summary of Changes
- Added a check in the 'main.go' file to determine if the operating system is Windows.
- If the operating system is Windows, checked if the binary name ends with '.exe' using 'strings.HasSuffix'.
- If the binary name does not end with '.exe', appended '.exe' to the binary name.
- This ensures that the binary name is recognized correctly on Windows systems.
Step 4: ⌨️ Coding
I have finished coding the issue. I am now reviewing it for completeness.
Step 5: 🔁 Code Review
Success! 🚀
To recreate the pull request, leave a comment prefixed with "sweep:" or edit the issue. Join Our Discord