mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-24 08:18:52 -03:00
Improve download and usage examples in README.md.
Addresses #239. The `go get` command fetches the command-line tool, and does not match the import path for the library. To make things more clear: 1. Mention explicitly that `go get` fetches the CLI. Also, to avoid potential issues with pre-modules Go versions, do the fetch in /tmp. 2. Include an import path explicitly in the source examples. 3. Mention explicitly how to import enry into a modules build. Signed-off-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
This commit is contained in:
parent
3c3ea9a95e
commit
e9af1d7187
20
README.md
20
README.md
@ -20,10 +20,11 @@ File programming language detector and toolbox to ignore binary or vendored file
|
|||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
The recommended way to install enry is to either [download a release](https://github.com/src-d/enry/releases) or
|
The recommended way to install the `enry` command-line tool is to either
|
||||||
|
[download a release](https://github.com/src-d/enry/releases) or run:
|
||||||
|
|
||||||
```
|
```
|
||||||
go get github.com/src-d/enry/cmd/enry
|
(cd /tmp; go get github.com/src-d/enry/v2/cmd/enry)
|
||||||
```
|
```
|
||||||
|
|
||||||
This project is now part of [source{d} Engine](https://sourced.tech/engine),
|
This project is now part of [source{d} Engine](https://sourced.tech/engine),
|
||||||
@ -32,9 +33,22 @@ Visit [sourced.tech/engine](https://sourced.tech/engine) for more information.
|
|||||||
|
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
------------
|
--------
|
||||||
|
|
||||||
|
If you are working in a [Go module](https://github.com/golang/go/wiki/Modules),
|
||||||
|
import `enry` to the module by running:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
go get github.com/src-d/enry/v2
|
||||||
|
```
|
||||||
|
|
||||||
|
The rest of the examples will assume you have either done this or fetched the
|
||||||
|
library into your `GOPATH`.
|
||||||
|
|
||||||
|
```go
|
||||||
|
// The examples here and below assume you have imported the library.
|
||||||
|
import "github.com/src-d/enry/v2"
|
||||||
|
|
||||||
lang, safe := enry.GetLanguageByExtension("foo.go")
|
lang, safe := enry.GetLanguageByExtension("foo.go")
|
||||||
fmt.Println(lang, safe)
|
fmt.Println(lang, safe)
|
||||||
// result: Go true
|
// result: Go true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user