Skip to content

Commit ec4bef5

Browse files
authored
feat: update notice file generation and move licenser to go tool (#664)
move licenser to go tool update notice file template (adapted from apm server) regenerate files
1 parent 3809958 commit ec4bef5

File tree

8 files changed

+366
-393
lines changed

8 files changed

+366
-393
lines changed

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
SHELL = /bin/bash -eo pipefail
22

33
GORELEASER_VERSION = "v1.19.2"
4-
GO_LICENSER_VERSION = "v0.4.0"
54
GOLANGCI_LINT_VERSION = "v1.64.4"
65
export DOCKER_IMAGE_NAME = observability/apm-lambda-extension
76
export DOCKER_REGISTRY = docker.elastic.co
@@ -42,14 +41,22 @@ lint:
4241
@if [ "$(CI)" != "" ]; then go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) version; fi
4342
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --build-tags tools
4443

44+
MODULE_DEPS=$(sort $(shell go list -deps -f "{{with .Module}}{{if not .Main}}{{.Path}}{{end}}{{end}}" .))
45+
4546
NOTICE.txt: go.mod
46-
@bash ./scripts/notice.sh
47+
go list -m -json $(MODULE_DEPS) | go tool go.elastic.co/go-licence-detector \
48+
-includeIndirect \
49+
-rules scripts/rules.json \
50+
-noticeTemplate scripts/templates/NOTICE.txt.tmpl \
51+
-noticeOut NOTICE.txt \
52+
-depsTemplate scripts/templates/dependencies.asciidoc.tmpl \
53+
-depsOut dependencies.asciidoc
4754

4855
.PHONY: check-licenses
4956
check-licenses:
50-
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing .
51-
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing -ext .java .
52-
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing -ext .js .
57+
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing .
58+
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing -ext .java .
59+
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing -ext .js .
5360

5461

5562
.PHONY: check-notice

NOTICE.txt

Lines changed: 304 additions & 311 deletions
Large diffs are not rendered by default.

dependencies.asciidoc

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,40 @@ This page lists the third-party dependencies used to build {n}.
1414
|===
1515
| Name | Version | Licence
1616

17+
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2$$] | v1.36.3 | Apache-2.0
1718
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/config$$] | v1.29.14 | Apache-2.0
19+
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/acm$$] | v1.32.0 | Apache-2.0
20+
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/secretsmanager$$] | v1.35.4 | Apache-2.0
21+
| link:https://github.com/tidwall/gjson[$$github.com/tidwall/gjson$$] | v1.18.0 | MIT
22+
| link:https://github.com/tidwall/sjson[$$github.com/tidwall/sjson$$] | v1.2.5 | MIT
23+
| link:https://go.elastic.co/ecszap[$$go.elastic.co/ecszap$$] | v1.0.3 | Apache-2.0
24+
| link:https://go.elastic.co/fastjson[$$go.elastic.co/fastjson$$] | v1.5.1 | MIT
25+
| link:https://go.uber.org/zap[$$go.uber.org/zap$$] | v1.27.0 | MIT
26+
|===
27+
28+
29+
[float]
30+
[id="{p}-dependencies-indirect"]
31+
== Indirect dependencies
32+
33+
[options="header"]
34+
|===
35+
| Name | Version | Licence
36+
1837
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/credentials$$] | v1.17.67 | Apache-2.0
1938
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/feature/ec2/imds$$] | v1.16.30 | Apache-2.0
2039
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/internal/configsources$$] | v1.3.34 | Apache-2.0
2140
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/internal/endpoints/v2$$] | v2.6.34 | Apache-2.0
2241
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/internal/ini$$] | v1.8.3 | Apache-2.0
23-
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/acm$$] | v1.31.3 | Apache-2.0
2442
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding$$] | v1.12.3 | Apache-2.0
2543
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/internal/presigned-url$$] | v1.12.15 | Apache-2.0
26-
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/secretsmanager$$] | v1.35.4 | Apache-2.0
2744
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/sso$$] | v1.25.3 | Apache-2.0
2845
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/ssooidc$$] | v1.30.1 | Apache-2.0
2946
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2/service/sts$$] | v1.33.19 | Apache-2.0
30-
| link:https://github.com/aws/aws-sdk-go-v2[$$github.com/aws/aws-sdk-go-v2$$] | v1.36.3 | Apache-2.0
3147
| link:https://github.com/aws/smithy-go[$$github.com/aws/smithy-go$$] | v1.22.2 | Apache-2.0
3248
| link:https://github.com/pkg/errors[$$github.com/pkg/errors$$] | v0.9.1 | BSD-2-Clause
33-
| link:https://github.com/tidwall/gjson[$$github.com/tidwall/gjson$$] | v1.18.0 | MIT
3449
| link:https://github.com/tidwall/match[$$github.com/tidwall/match$$] | v1.1.1 | MIT
3550
| link:https://github.com/tidwall/pretty[$$github.com/tidwall/pretty$$] | v1.2.1 | MIT
36-
| link:https://github.com/tidwall/sjson[$$github.com/tidwall/sjson$$] | v1.2.5 | MIT
37-
| link:https://go.elastic.co/ecszap[$$go.elastic.co/ecszap$$] | v1.0.3 | Apache-2.0
38-
| link:https://go.elastic.co/fastjson[$$go.elastic.co/fastjson$$] | v1.5.0 | MIT
3951
| link:https://go.uber.org/multierr[$$go.uber.org/multierr$$] | v1.11.0 | MIT
40-
| link:https://go.uber.org/zap[$$go.uber.org/zap$$] | v1.27.0 | MIT
4152
|===
4253

43-

go.mod

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ require (
1717
go.uber.org/zap v1.27.0
1818
)
1919

20-
tool github.com/terraform-docs/terraform-docs
20+
tool (
21+
github.com/elastic/go-licenser
22+
github.com/terraform-docs/terraform-docs
23+
go.elastic.co/go-licence-detector
24+
)
2125

2226
require (
2327
dario.cat/mergo v1.0.1 // indirect
@@ -38,11 +42,14 @@ require (
3842
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 // indirect
3943
github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 // indirect
4044
github.com/aws/smithy-go v1.22.2 // indirect
45+
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
4146
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
47+
github.com/elastic/go-licenser v0.4.2 // indirect
4248
github.com/fatih/color v1.17.0 // indirect
4349
github.com/fsnotify/fsnotify v1.7.0 // indirect
4450
github.com/golang/protobuf v1.5.4 // indirect
4551
github.com/google/go-cmp v0.6.0 // indirect
52+
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 // indirect
4653
github.com/hashicorp/go-hclog v1.6.3 // indirect
4754
github.com/hashicorp/go-plugin v1.6.1 // indirect
4855
github.com/hashicorp/go-version v1.7.0 // indirect
@@ -67,6 +74,7 @@ require (
6774
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6875
github.com/sagikazarmark/locafero v0.6.0 // indirect
6976
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
77+
github.com/sergi/go-diff v1.1.0 // indirect
7078
github.com/shopspring/decimal v1.4.0 // indirect
7179
github.com/sourcegraph/conc v0.3.0 // indirect
7280
github.com/spf13/afero v1.11.0 // indirect
@@ -80,6 +88,7 @@ require (
8088
github.com/tidwall/match v1.1.1 // indirect
8189
github.com/tidwall/pretty v1.2.1 // indirect
8290
github.com/zclconf/go-cty v1.15.0 // indirect
91+
go.elastic.co/go-licence-detector v0.7.0 // indirect
8392
go.uber.org/multierr v1.11.0 // indirect
8493
golang.org/x/crypto v0.36.0 // indirect
8594
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect

go.sum

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxY
4949
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
5050
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
5151
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
52+
github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo=
53+
github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
5254
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5355
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5456
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
5557
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
58+
github.com/elastic/go-licenser v0.4.2 h1:bPbGm8bUd8rxzSswFOqvQh1dAkKGkgAmrPxbUi+Y9+A=
59+
github.com/elastic/go-licenser v0.4.2/go.mod h1:W8eH6FaZDR8fQGm+7FnVa7MxI1b/6dAqxz+zPB8nm5c=
5660
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
5761
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
5862
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
@@ -69,6 +73,8 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
6973
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
7074
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
7175
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
76+
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 h1:OggOMmdI0JLwg1FkOKH9S7fVHF0oEm8PX6S8kAdpOps=
77+
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M=
7278
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
7379
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7480
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
@@ -148,6 +154,8 @@ github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE
148154
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
149155
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
150156
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
157+
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
158+
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
151159
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
152160
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
153161
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
@@ -167,6 +175,7 @@ github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+
167175
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
168176
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
169177
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
178+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
170179
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
171180
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
172181
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
@@ -196,6 +205,8 @@ go.elastic.co/ecszap v1.0.3 h1:RQtagS3uSftE8mPZ3msqb6mVI67jgcDuy1PUqiMv8ow=
196205
go.elastic.co/ecszap v1.0.3/go.mod h1:fM1RLWDU25TB/L48RUJgz5Le2AnoCeY/g0zf2op8gDU=
197206
go.elastic.co/fastjson v1.5.1 h1:zeh1xHrFH79aQ6Xsw7YxixvnOdAl3OSv0xch/jRDzko=
198207
go.elastic.co/fastjson v1.5.1/go.mod h1:WtvH5wz8z9pDOPqNYSYKoLLv/9zCWZLeejHWuvdL/EM=
208+
go.elastic.co/go-licence-detector v0.7.0 h1:qC31sfyfNcNx/zMYcLABU0ac3MbGHZgksCAb5lMDUMg=
209+
go.elastic.co/go-licence-detector v0.7.0/go.mod h1:f5ty8pjynzQD8BcS+s0qtlOGKc35/HKQxCVi8SHhV5k=
199210
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
200211
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
201212
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
@@ -251,6 +262,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
251262
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
252263
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
253264
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
265+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
266+
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
254267
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
255268
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
256269
honnef.co/go/tools v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34=

scripts/notice.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

scripts/overrides/overrides.json

Whitespace-only changes.

scripts/templates/NOTICE.txt.tmpl

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
{{- define "depInfo" -}}
22
{{- range $i, $dep := . }}
33
{{ "-" | line }}
4-
Module : {{ $dep.Name }}
5-
Version : {{ $dep.Version }}
6-
Time : {{ $dep.VersionTime }}
7-
Licence : {{ $dep.LicenceType }}
4+
Dependency : {{ $dep.Name }}
5+
Version: {{ $dep.Version }}
6+
Licence type (autodetected): {{ $dep.LicenceType }}
7+
{{ "-" | line }}
88

99
{{ $dep | licenceText }}
1010
{{ end }}
1111
{{- end -}}
1212

13-
Copyright {{ currentYear }} Elasticsearch BV
14-
15-
Licensed under the Apache License, Version 2.0 (the "License");
16-
you may not use this file except in compliance with the License.
17-
You may obtain a copy of the License at
18-
19-
http://www.apache.org/licenses/LICENSE-2.0
20-
21-
Unless required by applicable law or agreed to in writing, software
22-
distributed under the License is distributed on an "AS IS" BASIS,
23-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24-
See the License for the specific language governing permissions and
25-
limitations under the License.
13+
Elastic APM AWS Lambda extension
14+
Copyright 2021-{{ currentYear }} Elasticsearch BV
2615

2716
{{ "=" | line }}
2817
Third party libraries used by the Elastic APM AWS Lambda extension.
@@ -34,5 +23,5 @@ Third party libraries used by the Elastic APM AWS Lambda extension.
3423
{{ "=" | line }}
3524
Indirect dependencies
3625

37-
{{ template "depInfo" .Indirect }}
38-
{{ end }}
26+
{{ template "depInfo" .Indirect -}}
27+
{{- end}}

0 commit comments

Comments
 (0)