Skip to content

Commit

Permalink
doc: update usages README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy committed Feb 27, 2022
1 parent 50d4426 commit e633dd1
Showing 1 changed file with 69 additions and 12 deletions.
81 changes: 69 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,54 @@ into a directory in order to comply with license terms on redistribution.
## Installation

To download and install this tool, make sure
[you have Go v1.13 or later installed](https://golang.org/dl/), then run the
[you have Go v1.16 or later installed](https://golang.org/dl/), then run the
following command:

```shell
$ go get github.com/google/go-licenses
go get github.com/google/go-licenses
```

For Go v1.17 or later, [go get is deprecated for installing binaries](https://go.dev/doc/go-get-install-deprecation).
Use the following command instead to download and install this tool:

```shell
go install github.com/google/go-licenses@latest
```

Change directory to your go project, for example:

```shell
git clone git@github.com:google/go-licenses.git
cd go-licenses
```

## Reports

```shell
$ go-licenses csv "github.com/google/trillian/server/trillian_log_server"
google.golang.org/grpc,https://github.com/grpc/grpc-go/blob/master/LICENSE,Apache-2.0
go.opencensus.io,https://github.com/census-instrumentation/opencensus-go/blob/master/LICENSE,Apache-2.0
github.com/google/certificate-transparency-go,https://github.com/google/certificate-transparency-go/blob/master/LICENSE,Apache-2.0
github.com/jmespath/go-jmespath,https://github.com/aws/aws-sdk-go/blob/master/vendor/github.com/jmespath/go-jmespath/LICENSE,Apache-2.0
golang.org/x/text,https://go.googlesource.com/text/+/refs/heads/master/LICENSE,BSD-3-Clause
golang.org/x/sync/semaphore,https://go.googlesource.com/sync/+/refs/heads/master/LICENSE,BSD-3-Clause
github.com/prometheus/client_model/go,https://github.com/prometheus/client_model/blob/master/LICENSE,Apache-2.0
github.com/beorn7/perks/quantile,https://github.com/beorn7/perks/blob/master/LICENSE,MIT
$ go-licenses csv github.com/google/go-licenses
github.com/golang/glog,https://github.com/golang/glog/blob/master/LICENSE,Apache-2.0
github.com/google/licenseclassifier/stringclassifier,https://github.com/google/licenseclassifier/blob/master/stringclassifier/LICENSE,Apache-2.0
gopkg.in/warnings.v0,Unknown,BSD-2-Clause
github.com/emirpasic/gods,https://github.com/emirpasic/gods/blob/master/LICENSE,BSD-2-Clause
github.com/mitchellh/go-homedir,https://github.com/mitchellh/go-homedir/blob/master/LICENSE,MIT
github.com/google/licenseclassifier,https://github.com/google/licenseclassifier/blob/master/LICENSE,Apache-2.0
github.com/sergi/go-diff/diffmatchpatch,https://github.com/sergi/go-diff/blob/master/diffmatchpatch/LICENSE,MIT
golang.org/x/mod/semver,Unknown,BSD-3-Clause
golang.org/x/crypto,Unknown,BSD-3-Clause
golang.org/x/net,Unknown,BSD-3-Clause
github.com/kevinburke/ssh_config,https://github.com/kevinburke/ssh_config/blob/master/LICENSE,MIT
github.com/spf13/cobra,https://github.com/spf13/cobra/blob/master/LICENSE.txt,Apache-2.0
github.com/google/go-licenses,Unknown,Apache-2.0
golang.org/x/tools,Unknown,BSD-3-Clause
golang.org/x/sys,Unknown,BSD-3-Clause
golang.org/x/xerrors,Unknown,BSD-3-Clause
gopkg.in/src-d/go-git.v4,Unknown,Apache-2.0
gopkg.in/src-d/go-billy.v4,Unknown,Apache-2.0
github.com/jbenet/go-context/io,https://github.com/jbenet/go-context/blob/master/io/LICENSE,MIT
github.com/xanzy/ssh-agent,https://github.com/xanzy/ssh-agent/blob/master/LICENSE,Apache-2.0
github.com/src-d/gcfg,https://github.com/src-d/gcfg/blob/master/LICENSE,BSD-3-Clause
github.com/otiai10/copy,https://github.com/otiai10/copy/blob/master/LICENSE,MIT
github.com/spf13/pflag,https://github.com/spf13/pflag/blob/master/LICENSE,BSD-3-Clause
```

This command prints out a comma-separated report (CSV) listing the libraries
Expand All @@ -42,7 +71,7 @@ URLs may not be available if the library is not checked out as a Git repository
## Complying with license terms

```shell
$ go-licenses save "github.com/google/trillian/server/trillian_log_server" --save_path="/tmp/trillian_log_server"
$ go-licenses save "github.com/google/go-licenses" --save_path="/tmp/go-licenses-cli"
```

This command analyzes a binary/package's dependencies and determines what needs
Expand All @@ -64,6 +93,34 @@ considered forbidden by the license classifer. See

for licenses considered forbidden.

## Usages

Report usage:

```shell
go-licenses csv <package>
```

Complying with license terms usage:

```shell
go-licenses save <package> --save_path=<save_path>
```

Checking for forbidden licenses usage:

```shell
go-licenses check <package>
```

go-licenses expects the same package argument format as `go build`. For example,
it can be:

* A rooted import path like `github.com/google/go-licenses`.
* A relative path that denotes the package in that directory, like `.` or `./cmd/some-command`.

To learn more, run `go help packages`.

## Build tags

To read dependencies from packages with
Expand Down

0 comments on commit e633dd1

Please sign in to comment.