www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there an alternative of `go get`

reply Ky-Anh Huynh <saigon example.net> writes:
Hi everyone,

`go get` in Golang world has a simple way to fetch and install 
binary

```
$ go get github/foo/bar.git
$ export PATH=$PATH:$(go env GOPATH)/bin
$ bar --help
```

This saves a lot of time and setup. Is that an alternative when 
using dub?

Thanks a lot.
Aug 07 2020
parent reply Cogitri <oss cogitri.dev> writes:
On Friday, 7 August 2020 at 07:17:25 UTC, Ky-Anh Huynh wrote:
 Hi everyone,

 `go get` in Golang world has a simple way to fetch and install 
 binary

 ```
 $ go get github/foo/bar.git
 $ export PATH=$PATH:$(go env GOPATH)/bin
 $ bar --help
 ```

 This saves a lot of time and setup. Is that an alternative when 
 using dub?

 Thanks a lot.
Hello, you can use `dub build $name` to build the package. The resulting binary should be in $HOME/.dub/$name-$version/$name/bin then. You can also run the binary via `dub run $name -- $additional_args`, then you won't have to add that path to your PATH. If you haven't run `dub build $name` previously, `dub run $name` will do that for you.
Aug 07 2020
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 8/7/20 3:28 AM, Cogitri wrote:
 On Friday, 7 August 2020 at 07:17:25 UTC, Ky-Anh Huynh wrote:
 Hi everyone,

 `go get` in Golang world has a simple way to fetch and install binary

 ```
 $ go get github/foo/bar.git
 $ export PATH=$PATH:$(go env GOPATH)/bin
 $ bar --help
 ```

 This saves a lot of time and setup. Is that an alternative when using 
 dub?
Hello, you can use `dub build $name` to build the package. The resulting binary should be in $HOME/.dub/$name-$version/$name/bin then. You can also run the binary via `dub run $name -- $additional_args`, then you won't have to add that path to your PATH. If you haven't run `dub build $name` previously, `dub run $name` will do that for you.
Having a way to configure the path would be really helpful. I'll add a request for dub. -Steve
Aug 07 2020