Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
README: fix installation instructions
Browse files Browse the repository at this point in the history
Using GO111MODULE=off go get is a simple, backwards compatible way to
bootstrap to using gobin.
  • Loading branch information
myitcv committed Oct 29, 2018
1 parent bafb3fc commit a4b7997
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 103 deletions.
27 changes: 0 additions & 27 deletions .installation.sh

This file was deleted.

24 changes: 14 additions & 10 deletions .examples.sh → .readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ git config --global user.name "$GITHUB_USERNAME"
git config --global advice.detachedHead false
git config --global push.default current

unset GOPATH
# block: get
GO111MODULE=off go get -u github.com/myitcv/gobin

# these steps are effectively copied from .installation.sh
export GO111MODULE=on
git clone https://github.com/myitcv/gobin /tmp/gobin
cd /tmp/gobin
go install
pushd $(set -e; go list -f "{{.Dir}}" github.com/myitcv/gobin)
# TODO: drop this when we merge the vendor PR is merged
git fetch -q origin pull/20/head
git checkout -q FETCH_HEAD
GO111MODULE=off go install
popd

# block: fix path
export PATH=$(go env GOPATH)/bin:$PATH
which gobin

Expand All @@ -26,13 +30,13 @@ gobin github.com/rogpeppe/gohack
# block: gohack latest
gobin github.com/rogpeppe/gohack@latest

# block: gohack v1.0.0-alpha.1
gobin github.com/rogpeppe/gohack@v1.0.0-alpha.1
# block: gohack v1.0.0-alpha.2
gobin github.com/rogpeppe/gohack@v1.0.0-alpha.2

# block: gohack print
gobin -p github.com/rogpeppe/gohack@v1.0.0-alpha.1
gobin -p github.com/rogpeppe/gohack@v1.0.0-alpha.2

# block: gohack run
gobin -r github.com/rogpeppe/gohack@v1.0.0-alpha.1 -help
gobin -r github.com/rogpeppe/gohack@v1.0.0-alpha.2 -help
assert "$? -eq 2" $LINENO

92 changes: 26 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@
The gobin command installs/runs main packages.
<!-- END -->

### Installation

<!-- __JSON: go run github.com/myitcv/gobin -m -r myitcv.io/cmd/egrunner .installation.sh # LONG ONLINE
<!-- __JSON: go run github.com/myitcv/gobin -m -r myitcv.io/cmd/egrunner .readme.sh # LONG ONLINE
Clone the `gobin` repo:
```
{{PrintBlock "clone" -}}
```
Install:
### Installation
```
{{PrintBlock "install" | lineEllipsis 1 -}}
{{PrintBlock "get" -}}
```
Update your `PATH` and verify we can find `gobin` in our new `PATH`:
Expand All @@ -30,54 +22,8 @@ Update your `PATH` and verify we can find `gobin` in our new `PATH`:
{{PrintBlock "fix path" -}}
```
Use `gobin` as a "test":
```
{{PrintBlock "use" | lineEllipsis 4 -}}
```
-->

Clone the `gobin` repo:

```
$ export GO111MODULE=on
$ git clone https://github.com/myitcv/gobin /tmp/gobin
Cloning into '/tmp/gobin'...
$ cd /tmp/gobin
```

Install:

```
$ go install
...
```

Update your `PATH` and verify we can find `gobin` in our new `PATH`:

```
$ export PATH=$(go env GOPATH)/bin:$PATH
$ which gobin
/home/gopher/gopath/bin/gobin
```

Use `gobin` as a "test":

```
$ gobin -r github.com/rogpeppe/gohack@master -help
The gohack command checks out Go module dependencies
into a directory where they can be edited, and adjusts
the go.mod file appropriately.
...
```

<!-- END -->

### Examples
<!-- __JSON: go run github.com/myitcv/gobin -m -r myitcv.io/cmd/egrunner .examples.sh # LONG ONLINE
Globally install `gohack`:
```
Expand All @@ -87,7 +33,7 @@ Globally install `gohack`:
Install a specific version of `gohack`:
```
{{PrintBlock "gohack v1.0.0-alpha.1" -}}
{{PrintBlock "gohack v1.0.0-alpha.2" -}}
```
Print the `gobin` cache location of a specific `gohack` version:
Expand All @@ -102,34 +48,49 @@ Run a specific `gohack` version:
{{PrintBlock "gohack run" -}}
```
-->

### Installation

```
$ GO111MODULE=off go get -u github.com/myitcv/gobin
```

Update your `PATH` and verify we can find `gobin` in our new `PATH`:

```
$ export PATH=$(go env GOPATH)/bin:$PATH
$ which gobin
/home/gopher/gopath/bin/gobin
```

### Examples

Globally install `gohack`:

```
$ gobin github.com/rogpeppe/gohack
Installed github.com/rogpeppe/gohack@v0.0.1 to /home/gopher/go/bin/gohack
Installed github.com/rogpeppe/gohack@v0.0.1 to /home/gopher/gopath/bin/gohack
```

Install a specific version of `gohack`:

```
$ gobin github.com/rogpeppe/gohack@v1.0.0-alpha.1
Installed github.com/rogpeppe/gohack@v1.0.0-alpha.1 to /home/gopher/go/bin/gohack
$ gobin github.com/rogpeppe/gohack@v1.0.0-alpha.2
Installed github.com/rogpeppe/gohack@v1.0.0-alpha.2 to /home/gopher/gopath/bin/gohack
```

Print the `gobin` cache location of a specific `gohack` version:

```
$ gobin -p github.com/rogpeppe/gohack@v1.0.0-alpha.1
/home/gopher/.cache/gobin/github.com/rogpeppe/gohack/@v/v1.0.0-alpha.1/github.com/rogpeppe/gohack/gohack
$ gobin -p github.com/rogpeppe/gohack@v1.0.0-alpha.2
/home/gopher/.cache/gobin/github.com/rogpeppe/gohack/@v/v1.0.0-alpha.2/github.com/rogpeppe/gohack/gohack
```

Run a specific `gohack` version:

```
$ gobin -r github.com/rogpeppe/gohack@v1.0.0-alpha.1 -help
$ gobin -r github.com/rogpeppe/gohack@v1.0.0-alpha.2 -help
The gohack command checks out Go module dependencies
into a directory where they can be edited, and adjusts
the go.mod file appropriately.
Expand All @@ -147,7 +108,6 @@ The commands are:
Use "gohack help <command>" for more information about a command.
```


<!-- END -->

### Usage
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/rogpeppe/go-internal v1.0.0 h1:o4VLZ5jqHE+HahLT6drNtSGTrrUA3wPBmtpgqtdbClo=
github.com/rogpeppe/go-internal v1.0.0 h1:o4VLZ5jqHE+HahLT6drNtSGTrrUA3wPBmtpgqtdbClo=
github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday v1.5.1/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
Expand Down

0 comments on commit a4b7997

Please sign in to comment.