Go get downloads bin #198

Closed
opened 2026-01-19 18:29:23 +00:00 by michael · 5 comments
Owner

Originally created by @naguam on GitHub.

Hello,
I wanted to build your project to build an instance because of the "death" of the storj.io transfer.sh website.

I got curious about the go get behaviour with the modules, because before building, in the dependencies in the go directory where everything is downloaded with go get -u -v ./..., i got a working transfer.sh binary in /home/myuser/go/bin.

So for testing, I decided to not even clone the repository and just do
GO111MODULE=on go get -u github.com/dutchcoders/transfer.sh@master
And I also got the working binary.

It is a bit strange when wanting to build from source, we have the full working binary as dependency.
In this case, why building from source if building from source implies a binary ?
Maybe go get build the binary dependency (I'm not really convinced because the README.md says we have to build after the go get).

I don't really now how to formulate my question, but if someone can explain this to me, I'll appreciate 👍
Thank in advance.

Originally created by @naguam on GitHub. Hello, I wanted to build your project to build an instance because of the "death" of the storj.io transfer.sh website. I got curious about the go get behaviour with the modules, because before building, in the dependencies in the go directory where everything is downloaded with `go get -u -v ./...`, i got a working transfer.sh binary in /home/myuser/go/bin. So for testing, I decided to not even clone the repository and just do `GO111MODULE=on go get -u github.com/dutchcoders/transfer.sh@master` And I also got the working binary. It is a bit strange when wanting to build from source, we have the full working binary as dependency. In this case, why building from source if building from source implies a binary ? Maybe go get build the binary dependency (I'm not really convinced because the README.md says we have to build after the go get). I don't really now how to formulate my question, but if someone can explain this to me, I'll appreciate :+1: Thank in advance.
Author
Owner

@paolafrancesca commented on GitHub:

@naguam that's what go get is supposed to do: https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them

Get resolves and adds dependencies to the current development module and then builds and installs them.

the binary is not a dependency, it is installed by go get. if you don't want to build and install it you have to pass -d

if you want to have the source code for modification/whatever you should not use go get but rather clone the repo with git: this way you have an isolated copy of the source code you can deviate from that won't affect the go envoriment (imagine you change the code from the go pkg folder and then another project uses tranfer.sh as dependency: this project will be affected too)

I'm not really convinced because the README.md

README.md may be wrong, I will review it

@paolafrancesca commented on GitHub: @naguam that's what `go get` is supposed to do: https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them > Get resolves and adds dependencies to the current development module and then builds and installs them. the binary is not a dependency, it is installed by `go get`. if you don't want to build and install it you have to pass `-d` if you want to have the source code for modification/whatever you should not use `go get` but rather clone the repo with git: this way you have an isolated copy of the source code you can deviate from that won't affect the go envoriment (imagine you change the code from the go pkg folder and then another project uses tranfer.sh as dependency: this project will be affected too) >I'm not really convinced because the README.md README.md may be wrong, I will review it
Author
Owner

@paolafrancesca commented on GitHub:

I'm not really convinced because the README.md

README.md has go get -u -v ./..., from the cloned repo (even if not specified), to download the dependecies

@paolafrancesca commented on GitHub: > I'm not really convinced because the README.md README.md has `go get -u -v ./...`, from the cloned repo (even if not specified), to download the dependecies
Author
Owner

@naguam commented on GitHub:

I understand it is not for the README.md to explain go tools and this is not the problem.
However thank you for all theses explanations. I think I can close the issue.

@naguam commented on GitHub: I understand it is not for the README.md to explain go tools and this is not the problem. However thank you for all theses explanations. I think I can close the issue.
Author
Owner

@paolafrancesca commented on GitHub:

@naguam see updated README.md https://github.com/dutchcoders/transfer.sh/pull/328/files

with go modules go build will fetch the depdencies for you

it downloads also the binary.

to clarify: it doesn't download the binary, it builds and installs it in the GOPATH
the binary built with the last step (go build -o transfersh main.go) is saved in the same folder of the checkout repo not in the GOPATH

it is not the purpose of the README to explain the details of go tools, but in the new README.md I've reduced all the undeeded steps

@paolafrancesca commented on GitHub: @naguam see updated README.md https://github.com/dutchcoders/transfer.sh/pull/328/files with go modules `go build` will fetch the depdencies for you >it downloads also the binary. to clarify: it doesn't download the binary, it builds and installs it in the GOPATH the binary built with the last step (`go build -o transfersh main.go`) is saved in the same folder of the checkout repo not in the GOPATH it is not the purpose of the README to explain the details of go tools, but in the new README.md I've reduced all the undeeded steps
Author
Owner

@naguam commented on GitHub:

Thank you for the answer (the test when didn't cloned was to verify I could really have a working binary without the sources)
So with the sources: I tried go get -u -v ./... as in the README.md and it downloads also the binary.
Just doing go build without this first step don't download the binary and only the dependencies automatically for then build the binary but at the path I specified and it is not a downloaded bin.

I think it's strange that go get (as specified in the README.md) downloads also the binary even if it is not used as a dependency, go get here is used for the dependencies at the base for then just do go build.

@naguam commented on GitHub: Thank you for the answer (the test when didn't cloned was to verify I could really have a working binary without the sources) So with the sources: I tried `go get -u -v ./...` as in the README.md and it downloads also the binary. Just doing go build without this first step don't download the binary and only the dependencies automatically for then build the binary but at the path I specified and it is not a downloaded bin. I think it's strange that go get (as specified in the README.md) downloads also the binary even if it is not used as a dependency, go get here is used for the dependencies at the base for then just do go build.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#198