-
Notifications
You must be signed in to change notification settings - Fork 148
Ability for binary to be placed in current working folder #97
Comments
Can you describe your workflow a little more. Because gb has good support On Sat, 16 May 2015 13:24 William Kennedy notifications@github.com wrote:
|
In most cases I am working inside of Sublime, navigating between packages and hitting save to validate the code builds. That works today with gb. Sometimes the package has a main, most of the training repo is like this. When I hit save, I'm expecting a binary to be built to be run. At first I thought gb was broken building binaries. Then tonight I realized the binary was going to $GOPATH/bin. I don't want these binaries going to bin. I think the strength of gb is its compatibility with the standard GOPATH. However, this is an inconvenience mostly. If this can't change then gb clean becomes very important.
|
Can you configure sublime to always issue The reason I'm hesitant to add a |
Throwing stones. If the name of the binary to be created matches the projects folder name, build to /bin. If not, build to the current working folder.
|
On 16 May 2015 4:05 pm, "William Kennedy" notifications@github.com wrote:
Can you explain why this is important to you? Maybe I can find a different
Can you explain why this is not just a special case of building the whole
This issue isn't about working around the issues -o adds by adding more
|
I think there are two things at play here. (1), the need for backwards compatibility with my workflow using the traditional configured GOPATH. (2), how I view what building a binary means. (1). When I am working, I am focused on one package at a time. I only care if that package builds, vets and lints without fail. Building a binary in this workflow may not happens for days. If I decide to build the binary by moving to that package folder, it is primarily to know the entire project is building, veting, and linting. The binary that is produced is an artifact not for deployment. It might be run to validate a few things but in many cases it is just removed and the code committed to VC. (2). I never build a binary in my local environment for deployment. The thought of this actually makes my stomach churn. Code built for deployment should only be built by the CI/CD systems and as automated as possible. In the case of CI/CD, using the "all" option makes a lot of sense. I expect to be using it for sure. In my development workflow, using "-q" gives me what I want. The "/bin" folder is for binaries that are to be installed. When I am working, I am never building a binary to be installed. I never want the binary to go to /bin. That is a sacred place that is tied to my environment and/or deployment. Now I know "gb" changed some of the rules and it can because it is its own tool. It does not sit on top of the current go tool. It has the freedom to do this. However, the tool needs to be respectful to how people work or have been working. If the tool disrupts this too much, then people will feel they can't use it. So my requested changes are not for building code to deploy, they are for the everyday use of the tool as a developer. -- Bill
|
Thanks for your reply Bill, but I'm afraid it had only made me more On 17 May 2015 10:26 pm, "William Kennedy" notifications@github.com wrote:
Ok, so why does it matter if the binary is built in the working directory
Ok, but you haven't explained why the workflow I gave above is
I agree, but this seems orthogonal to this request
I disagree, bin/ and pkg/ are temporary directories that contain cached This is given further weight as project/bin is rarely in your path.
I agree with what you have said, but you need to help me understand why you
|
I found this issue while trying to figure out where the 'gb' binary got installed. Never knew that I should have $GOPATH/bin listed in my $PATH as well! I guess what @ardan-bkennedy wants to say is that $GOPATH/bin should be treated the same as, say, /usr/bin, where you drop binaries only when you mean to install them. It's not common for build tools to install binaries in a place like /usr/bin – or even $HOME/bin – unless they're processing an installation target (e.g. make install). I wonder if defaulting to $PROJECT/bin might work better since it's consistent with expectations from a project-centric layout. |
That's what gb does now. |
Jumping into the pool here. My use case is from a CI environment. Using a docker build image like so:
Because gb is installed in the GOPATH/bin directory, I can't bind-mount the GOPATH/bin directory to get the binary I've built back out of the container (because there'd be no gb binary to build) -- chicken & egg. If I could specify an output directory, I could bind an /output directory and build to there, grab that binary and put it in a skinny docker container for runtime. Workarounds are welcomed, if anyone has some. |
I don't understand what you are saying, gb builds binaries into |
aha! My problem is that project/bin and GOPATH/bin are one and the same. You're brilliant. |
There doesn't seem to be an agreed upon course of action here. Closing. |
I appreciate the binary is created in the /bin folder. However, when developing day to day, having the option to place the binary in the current working folder is a convenience that is hard to leave behind. My development workflow is based on this happening every time I hit Save on a code file with main().
The text was updated successfully, but these errors were encountered: