@@ -39,7 +39,7 @@ If you were using `go get` to install this tool, note that
3939## Reports
4040
4141``` shell
42- $ go-licenses csv github.com/google/go-licenses
42+ $ go-licenses report github.com/google/go-licenses
4343W0410 06:02:57.077781 31529 library.go:86] " golang.org/x/sys/unix" contains non-Go code that can' t be inspected for further dependencies:
4444/home/username/go/pkg/mod/golang.org/x/[email protected] /unix/asm_linux_amd64.s 4545W0410 06:02:59.476443 31529 library.go:86] "golang.org/x/crypto/curve25519/internal/field" contains non-Go code that can' t be inspected for further dependencies:
@@ -83,21 +83,76 @@ share a license file.
8383
8484URLs are versioned based on go modules metadata.
8585
86- **Tip**: go-licenses writes CSV to stdout and info/warnings/errors logs to stderr.
87- To save the CSV to a file `licenses.csv` in bash, run:
86+ **Tip**: go-licenses writes the report to stdout and info/warnings/errors logs
87+ to stderr. To save the CSV to a file `licenses.csv` in bash, run:
8888
8989```bash
90- go-licenses csv github.com/google/go-licenses > licenses.csv
90+ go-licenses report github.com/google/go-licenses > licenses.csv
9191```
9292
9393Or, to also save error logs to an `errors` file, run:
9494
9595```bash
96- go-licenses csv github.com/google/go-licenses > licenses.csv 2> errors
96+ go-licenses report github.com/google/go-licenses > licenses.csv 2> errors
9797```
9898
9999**Note**: some warnings and errors may be expected, refer to [Warnings and Errors](#warnings-and-errors) for more information.
100100
101+ ## Reports with Custom Templates
102+
103+ ```shell
104+ go-licenses report github.com/google/go-licenses --template testdata/modules/hello01/licenses.tpl
105+ W0822 16:56:50.696198 10200 library.go:94] "golang.org/x/sys/unix" contains non-Go code that can' t be inspected for further dependencies:
106+ /Users/willnorris/go/pkg/mod/golang.org/x/
[email protected] /unix/asm_bsd_arm64.s
107+ /Users/willnorris/go/pkg/mod/golang.org/x/
[email protected] /unix/zsyscall_darwin_arm64.1_13.s
108+ /Users/willnorris/go/pkg/mod/golang.org/x/
[email protected] /unix/zsyscall_darwin_arm64.s
109+ W0822 16:56:51.466449 10200 library.go:94] " golang.org/x/crypto/chacha20" contains non-Go code that can' t be inspected for further dependencies:
110+ /Users/willnorris/go/pkg/mod/golang.org/x/[email protected] /chacha20/chacha_arm64.s 111+ W0822 16:56:51.475139 10200 library.go:94] "golang.org/x/crypto/curve25519/internal/field" contains non-Go code that can' t be inspected for further dependencies:
112+ /Users/willnorris/go/pkg/mod/golang.org/x/
[email protected] /curve25519/internal/field/fe_arm64.s
113+ W0822 16:56:51.602250 10200 library.go:269] module github.com/google/go-licenses has empty version, defaults to HEAD. The license URL may be incorrect. Please verify!
114+ W0822 16:56:51.605074 10200 library.go:269] module github.com/google/go-licenses has empty version, defaults to HEAD. The license URL may be incorrect. Please verify!
115+
116+ - github.com/emirpasic/gods ([BSD-2-Clause](https://github.com/emirpasic/gods/blob/v1.12.0/LICENSE))
117+ - github.com/golang/glog ([Apache-2.0](https://github.com/golang/glog/blob/23def4e6c14b/LICENSE))
118+ - github.com/golang/groupcache/lru ([Apache-2.0](https://github.com/golang/groupcache/blob/41bb18bfe9da/LICENSE))
119+ - github.com/google/go-licenses ([Apache-2.0](https://github.com/google/go-licenses/blob/HEAD/LICENSE))
120+ - github.com/google/go-licenses/internal/third_party/pkgsite ([BSD-3-Clause](https://github.com/google/go-licenses/blob/HEAD/internal/third_party/pkgsite/LICENSE))
121+ - github.com/google/licenseclassifier ([Apache-2.0](https://github.com/google/licenseclassifier/blob/3043a050f148/LICENSE))
122+ - github.com/google/licenseclassifier/licenses ([Unlicense](https://github.com/google/licenseclassifier/blob/3043a050f148/licenses/Unlicense.txt))
123+ - github.com/google/licenseclassifier/stringclassifier ([Apache-2.0](https://github.com/google/licenseclassifier/blob/3043a050f148/stringclassifier/LICENSE))
124+ - github.com/jbenet/go-context/io ([MIT](https://github.com/jbenet/go-context/blob/d14ea06fba99/LICENSE))
125+ - github.com/kevinburke/ssh_config ([MIT](https://github.com/kevinburke/ssh_config/blob/01f96b0aa0cd/LICENSE))
126+ - github.com/mitchellh/go-homedir ([MIT](https://github.com/mitchellh/go-homedir/blob/v1.1.0/LICENSE))
127+ - github.com/otiai10/copy ([MIT](https://github.com/otiai10/copy/blob/v1.6.0/LICENSE))
128+ - github.com/sergi/go-diff/diffmatchpatch ([MIT](https://github.com/sergi/go-diff/blob/v1.2.0/LICENSE))
129+ - github.com/spf13/cobra ([Apache-2.0](https://github.com/spf13/cobra/blob/v1.5.0/LICENSE.txt))
130+ - github.com/spf13/pflag ([BSD-3-Clause](https://github.com/spf13/pflag/blob/v1.0.5/LICENSE))
131+ - github.com/src-d/gcfg ([BSD-3-Clause](https://github.com/src-d/gcfg/blob/v1.4.0/LICENSE))
132+ - github.com/xanzy/ssh-agent ([Apache-2.0](https://github.com/xanzy/ssh-agent/blob/v0.2.1/LICENSE))
133+ - go.opencensus.io ([Apache-2.0](https://github.com/census-instrumentation/opencensus-go/blob/v0.23.0/LICENSE))
134+ - golang.org/x/crypto ([BSD-3-Clause](https://cs.opensource.google/go/x/crypto/+/5e0467b6:LICENSE))
135+ - golang.org/x/mod/semver ([BSD-3-Clause](https://cs.opensource.google/go/x/mod/+/86c51ed2:LICENSE))
136+ - golang.org/x/net ([BSD-3-Clause](https://cs.opensource.google/go/x/net/+/a158d28d:LICENSE))
137+ - golang.org/x/sys ([BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/8c9f86f7:LICENSE))
138+ - golang.org/x/tools ([BSD-3-Clause](https://cs.opensource.google/go/x/tools/+/v0.1.12:LICENSE))
139+ - gopkg.in/src-d/go-billy.v4 ([Apache-2.0](https://github.com/src-d/go-billy/blob/v4.3.2/LICENSE))
140+ - gopkg.in/src-d/go-git.v4 ([Apache-2.0](https://github.com/src-d/go-git/blob/v4.13.1/LICENSE))
141+ - gopkg.in/warnings.v0 ([BSD-2-Clause](https://github.com/go-warnings/warnings/blob/v0.1.2/LICENSE))
142+ ```
143+
144+ This command executes a specified Go template file to generate a report of
145+ licenses. The template file is passed a slice of structs containing license
146+ data:
147+
148+ ``` go
149+ []struct {
150+ Name string
151+ LicenseURL string
152+ LicenseName string
153+ }
154+ ```
155+
101156## Save licenses, copyright notices and source code (depending on license type)
102157
103158``` shell
@@ -124,10 +179,16 @@ for licenses considered forbidden.
124179
125180## Usages
126181
127- Report usage:
182+ Report usage (default csv output):
183+
184+ ``` shell
185+ go-licenses report < package> [package...]
186+ ```
187+
188+ Report usage (using custom template file):
128189
129190``` shell
130- go-licenses csv < package> [package...]
191+ go-licenses report < package> [package...] --template= < template_file >
131192```
132193
133194Save licenses, copyright notices and source code (depending on license type):
@@ -159,7 +220,7 @@ To read dependencies from packages with
159220` $GOFLAGS ` environment variable.
160221
161222``` shell
162- $ GOFLAGS=" -tags=tools" go-licenses csv google.golang.org/grpc/test/tools
223+ $ GOFLAGS=" -tags=tools" go-licenses report google.golang.org/grpc/test/tools
163224github.com/BurntSushi/toml,https://github.com/BurntSushi/toml/blob/master/COPYING,MIT
164225google.golang.org/grpc/test/tools,Unknown,Apache-2.0
165226honnef.co/go/tools/lint,Unknown,BSD-3-Clause
@@ -183,7 +244,7 @@ $ go-licenses check \
183244```
184245
185246Note that dependencies from the ignored packages are still resolved and checked.
186- This flag makes effect to `check`, `csv ` and `save` commands.
247+ This flag makes effect to ` check ` , ` report ` and ` save ` commands.
187248
188249## Warnings and errors
189250
0 commit comments