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
Encouraging people to clone the repo means they won't get a sensible
tagged version. Instead, use the "hack" of creating a temporary module,
adding github.com/myitcv/gobin as a dependency via go get, then using go
install. The logic in go get will use the latest tagged version.

Resulting README can be seen at
https://github.com/myitcv/gobin/blob/fix_installation_instructions/README.md

Also bump to v1.0.0 of go-internal and myitcv.io@latest in the process.

Use v1.0.0-alpha.2 of gohack for examples.
  • Loading branch information
myitcv committed Oct 25, 2018
1 parent daa7241 commit d81fe27
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 99 deletions.
27 changes: 0 additions & 27 deletions .installation.sh

This file was deleted.

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

unset GOPATH

# these steps are effectively copied from .installation.sh
# block: clone
export GO111MODULE=on
git clone https://github.com/myitcv/gobin /tmp/gobin
cd /tmp/gobin
go install
cd $(mktemp -d)
go mod init mod
go get -m github.com/myitcv/gobin

# block: install
go install github.com/myitcv/gobin

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

Expand All @@ -26,13 +29,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

91 changes: 37 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
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
### Installation
Clone the `gobin` repo:
Use a temporary module to get the latest version of `github.com/myitcv/gobin`:
```
{{PrintBlock "clone" -}}
{{PrintBlock "clone" | lineEllipsis 5 -}}
```
Install:
Expand All @@ -30,106 +31,89 @@ 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 -}}
```
-->
### Examples
Clone the `gobin` repo:
Globally install `gohack`:
```
$ export GO111MODULE=on
$ git clone https://github.com/myitcv/gobin /tmp/gobin
Cloning into '/tmp/gobin'...
$ cd /tmp/gobin
{{PrintBlock "gohack" -}}
```
Install:
Install a specific version of `gohack`:
```
$ go install
...
{{PrintBlock "gohack v1.0.0-alpha.2" -}}
```
Update your `PATH` and verify we can find `gobin` in our new `PATH`:
Print the `gobin` cache location of a specific `gohack` version:
```
$ export PATH=$(go env GOPATH)/bin:$PATH
$ which gobin
/home/gopher/gopath/bin/gobin
{{PrintBlock "gohack print" -}}
```
Use `gobin` as a "test":
Run a specific `gohack` version:
```
$ 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.
...
{{PrintBlock "gohack run" -}}
```
<!-- END -->

### Examples

<!-- __JSON: go run github.com/myitcv/gobin -m -r myitcv.io/cmd/egrunner .examples.sh # LONG ONLINE
Globally install `gohack`:
-->

```
{{PrintBlock "gohack" -}}
```
### Installation

Install a specific version of `gohack`:
Use a temporary module to get the latest version of `github.com/myitcv/gobin`:

```
{{PrintBlock "gohack v1.0.0-alpha.1" -}}
$ export GO111MODULE=on
$ cd $(mktemp -d)
$ go mod init mod
go: creating new go.mod: module mod
$ go get -m github.com/myitcv/gobin
...
```

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

```
{{PrintBlock "gohack print" -}}
$ go install github.com/myitcv/gobin
...
```

Run a specific `gohack` version:
Update your `PATH` and verify we can find `gobin` in our new `PATH`:

```
{{PrintBlock "gohack run" -}}
$ 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 +131,6 @@ The commands are:
Use "gohack help <command>" for more information about a command.
```


<!-- END -->

### Usage
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/myitcv/gobin

require (
github.com/rogpeppe/go-internal v1.0.0-alpha
myitcv.io v0.0.0-20181024001312-926e6775fd21
github.com/rogpeppe/go-internal v1.0.0
myitcv.io v0.0.0-20181024170518-69843ea77cfd
)

replace github.com/rogpeppe/go-internal => github.com/myitcv/go-internal v1.0.0-alpha.0.20181023085657-b3919076a82e
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/myitcv/go-internal v1.0.0-alpha.0.20181023085657-b3919076a82e h1:DdePa8RW95raZ79rL4AU915Lpdyz8FmStI+ng+Hf7Ls=
github.com/myitcv/go-internal v1.0.0-alpha.0.20181023085657-b3919076a82e/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
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/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=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -47,5 +47,5 @@ honnef.co/go/js/util v0.0.0-20150216223935-96b8dd9d1621/go.mod h1:WrAIh8rWfzvMdL
honnef.co/go/js/xhr v0.0.0-20150307031022-00e3346113ae/go.mod h1:QwoYXdHZpuR080H32s5jqyk7zh/k/U9bDFg2g8OMmOM=
mvdan.cc/sh v2.5.0+incompatible h1:JNM6l18iQFGZl0dK2n/7Z85sNaFq9zSl3qooNNyl+qA=
mvdan.cc/sh v2.5.0+incompatible/go.mod h1:IeeQbZq+x2SUGBensq/jge5lLQbS3XT2ktyp3wrt4x8=
myitcv.io v0.0.0-20181024001312-926e6775fd21 h1:OHvJTKuOUN+9gMs9zy8NJL6d+Yob+yiKOX14mJO/ifs=
myitcv.io v0.0.0-20181024001312-926e6775fd21/go.mod h1:0yVf2bHw6qSFxyjj1hJ+yA68GjlMIr6FZcQgBG9Cqq0=
myitcv.io v0.0.0-20181024170518-69843ea77cfd h1:wJZBNGj4rAqFC7Uvj8qeJ8rBKfhbvj47g/0wkN5R0Ew=
myitcv.io v0.0.0-20181024170518-69843ea77cfd/go.mod h1:0yVf2bHw6qSFxyjj1hJ+yA68GjlMIr6FZcQgBG9Cqq0=

0 comments on commit d81fe27

Please sign in to comment.