Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/otaviof/go-get-d
Brings back `go get -d` to modern Go
https://github.com/otaviof/go-get-d
go
Last synced: about 1 month ago
JSON representation
Brings back `go get -d` to modern Go
- Host: GitHub
- URL: https://github.com/otaviof/go-get-d
- Owner: otaviof
- License: apache-2.0
- Created: 2022-06-04T16:12:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T20:41:47.000Z (9 months ago)
- Last Synced: 2024-06-20T13:32:54.980Z (5 months ago)
- Topics: go
- Language: Go
- Homepage:
- Size: 555 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![test][workflowsTestBadge]][workflowsTest]
`go-get-d`
----------## Abstract
This application brings back the `go get -d` functionality to *modern* Go. If you're looking for a helper tool to organize Go projects under `${GOPATH}`, this is for you!
The classic `go get -d` use to clone the import repository and build the application right away, placing the executable on the `${GOPATH}/bin` directory. Nowadays, you adopt the `go install` if the idea is only install the application executable.
Thus `go-get-d` is most useful for a developer to quickly get started on a Go repository, using the "classic" `${GOPATH}` organization style.
## Installation
Use `go install` as the following example:
```bash
go install github.com/otaviof/go-get-d@latest
```When working on this repository you can alternatively use the `install` target, i.e.:
```bash
make install
```The executable is placed on `${GOPATH}/bin`.
## Usage
The usage is straightforward, the only input required is the import name. For instance:
```bash
go-get-d github.com/otaviof/go-get-d
```## Shell Eval
A practical way to clone the import repository and enter the directory, is using `go-get-d` output as a shell `eval` expession. The shell will pick executed the uncommented commands, i.e.:
```bash
eval "$(go-get-d github.com/otaviof/go-get-d)"
```The output produced follow the snippet below:
```
$ go-get-d github.com/otaviof/go-get-d
# Go Module: "github.com/otaviof/go-get-d"
# Directory: "${GOPATH}/src/github.com/otaviof/go-get-d"
cd "${GOPATH}/src/github.com/otaviof/go-get-d"
```After you run the `eval`, the current directory will change accordingly:
```
$ eval "$(go-get-d github.com/otaviof/go-get-d)"
$ pwd
/home/otaviof/go/src/github.com/otaviof/go-get-d
```## Inspect Import
You can additionally *inspect* the given import searching for the `main` package, when found it will be subject to `go build`, creating the application executable. Please consider the usage of the `--inspect` flag:
```bash
go-get-d --inspect [import]
```For example:
```
$ go-get-d --inspect github.com/otaviof/go-get-d
# Go Module: "github.com/otaviof/go-get-d"
# Directory: "${GOPATH}/src/github.com/otaviof/go-get-d"
# Cloning repository...
$ git clone https://github.com/otaviof/go-get-d ~/go/src/github.com/otaviof/go-get-d
## Cloning into '/Users/otaviof/go/src/github.com/otaviof/go-get-d'...
# Inspecting Go package...
# All done!
```
The `--inspect` will act as `go install`, therefore the application executable is stored on the `${GOPATH}/bin`.[workflowsTest]: https://github.com/otaviof/go-get-d/actions/workflows/test.yaml
[workflowsTestBadge]: https://github.com/otaviof/go-get-d/actions/workflows/test.yaml/badge.svg