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

README: fix installation instructions #19

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .installation.sh

This file was deleted.

17 changes: 7 additions & 10 deletions .examples.sh → .readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ 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
# block: fix path
export PATH=$(go env GOPATH)/bin:$PATH
which gobin

Expand All @@ -26,13 +23,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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you actually need the GO111MODULE=off part here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we do. Because otherwise, if the user is in the context of a module, it will modify that go.mod which is the whole complaint raised in golang/go#27643. I definitely want to side-step that here.

```

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=
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unclear why these two lines are being added here... because it results in two rows being duplicated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that doesn't seem quite right.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised #21 to investigate at a later date

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