go-get-d

command module
v0.0.0-...-570b08d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

test

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:

go install github.com/otaviof/go-get-d@latest

When working on this repository you can alternatively use the install target, i.e.:

make install

The executable is placed on ${GOPATH}/bin.

Usage

The usage is straightforward, the only input required is the import name. For instance:

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.:

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:

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL