From c27bfadd1ff98095c0626ff61de7d42ff6082267 Mon Sep 17 00:00:00 2001 From: Chris Gavin Date: Mon, 24 Aug 2020 16:11:38 +0100 Subject: [PATCH] Add a `licenses` subcommand that prints the licenses of all dependencies. --- .github/workflows/ci.yml | 2 + .github/workflows/release.yml | 2 + .gitignore | 1 + .goreleaser.yml | 4 ++ .../go/github.com/gobuffalo/here.dep.yml | 32 +++++++++++++++ .../go/github.com/markbates/pkger.dep.yml | 32 +++++++++++++++ .../github.com/markbates/pkger/here.dep.yml | 32 +++++++++++++++ .../markbates/pkger/internal/maps.dep.yml | 32 +++++++++++++++ .../github.com/markbates/pkger/pkging.dep.yml | 32 +++++++++++++++ .../markbates/pkger/pkging/stdos.dep.yml | 32 +++++++++++++++ .licenses/go/github.com/spf13/pflag.dep.yml | 2 +- cmd/licenses.go | 14 +++++++ cmd/root.go | 1 + go.mod | 5 +++ go.sum | 16 ++++++++ internal/licenses/licenses.go | 41 +++++++++++++++++++ 16 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 .licenses/go/github.com/gobuffalo/here.dep.yml create mode 100644 .licenses/go/github.com/markbates/pkger.dep.yml create mode 100644 .licenses/go/github.com/markbates/pkger/here.dep.yml create mode 100644 .licenses/go/github.com/markbates/pkger/internal/maps.dep.yml create mode 100644 .licenses/go/github.com/markbates/pkger/pkging.dep.yml create mode 100644 .licenses/go/github.com/markbates/pkger/pkging/stdos.dep.yml create mode 100644 cmd/licenses.go create mode 100644 internal/licenses/licenses.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 593a7cb..145a51b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,8 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.14.7 + - name: Install Pkger + run: go get github.com/markbates/pkger/cmd/pkger - name: Build uses: goreleaser/goreleaser-action@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05bc4e2..c92e8cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,8 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.14.7 + - name: Install Pkger + run: go get github.com/markbates/pkger/cmd/pkger - name: Release uses: goreleaser/goreleaser-action@v2 with: diff --git a/.gitignore b/.gitignore index 9b6cc63..a8bd9c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /codeql-action-sync /dist/ +/pkged.go diff --git a/.goreleaser.yml b/.goreleaser.yml index 2ba8522..96ddb56 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,9 @@ project_name: codeql-action-sync +before: + hooks: + - pkger + builds: - goos: [linux, darwin, windows] goarch: [386, amd64, arm64] diff --git a/.licenses/go/github.com/gobuffalo/here.dep.yml b/.licenses/go/github.com/gobuffalo/here.dep.yml new file mode 100644 index 0000000..5b6181e --- /dev/null +++ b/.licenses/go/github.com/gobuffalo/here.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/gobuffalo/here +version: v0.6.0 +type: go +summary: +homepage: https://godoc.org/github.com/gobuffalo/here +license: mit +licenses: +- sources: LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/markbates/pkger.dep.yml b/.licenses/go/github.com/markbates/pkger.dep.yml new file mode 100644 index 0000000..366c6b4 --- /dev/null +++ b/.licenses/go/github.com/markbates/pkger.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/markbates/pkger +version: v0.17.0 +type: go +summary: +homepage: https://godoc.org/github.com/markbates/pkger +license: mit +licenses: +- sources: LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/markbates/pkger/here.dep.yml b/.licenses/go/github.com/markbates/pkger/here.dep.yml new file mode 100644 index 0000000..d3f54cb --- /dev/null +++ b/.licenses/go/github.com/markbates/pkger/here.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/markbates/pkger/here +version: v0.17.0 +type: go +summary: +homepage: https://godoc.org/github.com/markbates/pkger/here +license: mit +licenses: +- sources: pkger@v0.17.0/LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/markbates/pkger/internal/maps.dep.yml b/.licenses/go/github.com/markbates/pkger/internal/maps.dep.yml new file mode 100644 index 0000000..6f841ac --- /dev/null +++ b/.licenses/go/github.com/markbates/pkger/internal/maps.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/markbates/pkger/internal/maps +version: v0.17.0 +type: go +summary: +homepage: https://godoc.org/github.com/markbates/pkger/internal/maps +license: mit +licenses: +- sources: pkger@v0.17.0/LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/markbates/pkger/pkging.dep.yml b/.licenses/go/github.com/markbates/pkger/pkging.dep.yml new file mode 100644 index 0000000..a8cf62d --- /dev/null +++ b/.licenses/go/github.com/markbates/pkger/pkging.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/markbates/pkger/pkging +version: v0.17.0 +type: go +summary: +homepage: https://godoc.org/github.com/markbates/pkger/pkging +license: mit +licenses: +- sources: pkger@v0.17.0/LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/markbates/pkger/pkging/stdos.dep.yml b/.licenses/go/github.com/markbates/pkger/pkging/stdos.dep.yml new file mode 100644 index 0000000..ec0d2e0 --- /dev/null +++ b/.licenses/go/github.com/markbates/pkger/pkging/stdos.dep.yml @@ -0,0 +1,32 @@ +--- +name: github.com/markbates/pkger/pkging/stdos +version: v0.17.0 +type: go +summary: +homepage: https://godoc.org/github.com/markbates/pkger/pkging/stdos +license: mit +licenses: +- sources: pkger@v0.17.0/LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2019 Mark Bates + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: [] diff --git a/.licenses/go/github.com/spf13/pflag.dep.yml b/.licenses/go/github.com/spf13/pflag.dep.yml index a202e4c..95b6dff 100644 --- a/.licenses/go/github.com/spf13/pflag.dep.yml +++ b/.licenses/go/github.com/spf13/pflag.dep.yml @@ -1,6 +1,6 @@ --- name: github.com/spf13/pflag -version: v1.0.3 +version: v1.0.5 type: go summary: Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. diff --git a/cmd/licenses.go b/cmd/licenses.go new file mode 100644 index 0000000..76d6eea --- /dev/null +++ b/cmd/licenses.go @@ -0,0 +1,14 @@ +package cmd + +import ( + "github.com/github/codeql-action-sync/internal/licenses" + "github.com/spf13/cobra" +) + +var licensesCmd = &cobra.Command{ + Use: "licenses", + Short: "Display the licenses of all the dependencies of this tool.", + RunE: func(cmd *cobra.Command, args []string) error { + return licenses.PrintLicenses() + }, +} diff --git a/cmd/root.go b/cmd/root.go index 2aeaba4..087244e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,6 +51,7 @@ func Execute(ctx context.Context) error { } rootCmd.AddCommand(versionCmd) + rootCmd.AddCommand(licensesCmd) rootCmd.AddCommand(pullCmd) pullFlags.Init(pullCmd) diff --git a/go.mod b/go.mod index 89db6bc..85290f5 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,14 @@ require ( github.com/go-git/go-git/v5 v5.1.0 github.com/google/go-github/v32 v32.1.0 github.com/gorilla/mux v1.8.0 + github.com/markbates/pkger v0.17.0 github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e github.com/pkg/errors v0.8.1 github.com/spf13/cobra v1.0.0 + github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.6.1 + golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect + golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be + golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 // indirect ) diff --git a/go.sum b/go.sum index e193e3d..7d10292 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/here v0.6.0 h1:hYrd0a6gDmWxBM4TnrGw8mQg24iSVoIkHEk7FodQcBI= +github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -94,6 +96,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/pkger v0.17.0 h1:RFfyBPufP2V6cddUyyEVSHBpaAnM1WzaMNyqomeT+iY= +github.com/markbates/pkger v0.17.0/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -135,6 +139,8 @@ github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHN github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= @@ -158,6 +164,9 @@ golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -168,6 +177,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -182,6 +193,9 @@ golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 h1:AvbQYmiaaaza3cW3QXRyPo5kYgpFIzOAfeAAN7m3qQ4= +golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -209,6 +223,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/licenses/licenses.go b/internal/licenses/licenses.go new file mode 100644 index 0000000..1136c4b --- /dev/null +++ b/internal/licenses/licenses.go @@ -0,0 +1,41 @@ +package licenses + +import ( + "fmt" + "io/ioutil" + "os" + + "github.com/markbates/pkger" + "github.com/pkg/errors" +) + +const errorMessage = "Error reading licenses." + +func PrintLicenses() error { + fmt.Println("This tool could not have been built without all the wonderful developer communities who maintain these dependencies.") + err := pkger.Walk("/.licenses", func(path string, info os.FileInfo, err error) error { + if err != nil { + return errors.Wrap(err, errorMessage) + } + if info.IsDir() { + return nil + } + + reader, err := pkger.Open(path) + if err != nil { + return errors.Wrap(err, errorMessage) + } + defer reader.Close() + content, err := ioutil.ReadAll(reader) + if err != nil { + return errors.Wrap(err, errorMessage) + } + fmt.Println(string(content)) + + return nil + }) + if err != nil { + return errors.Wrap(err, errorMessage) + } + return nil +}