diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 237d594..c9acb82 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -39,45 +39,13 @@ pipeline { axes { axis { name 'GO_VERSION' - values '1.15.6', '1.11', '1.10', '1.9' + values '1.17', '1.16', '1.15', '1.14', '1.13' } axis { name 'PLATFORM' values 'ubuntu-18 && immutable', 'macosx&&x86_64' } } - excludes { - exclude { - axis { - name 'PLATFORM' - values 'macosx&&x86_64' - } - axis { - name 'GO_VERSION' - values '1.11' - } - } - exclude { - axis { - name 'PLATFORM' - notValues 'macosx&&x86_64' - } - axis { - name 'GO_VERSION' - values '1.10' - } - } - exclude { - axis { - name 'PLATFORM' - notValues 'macosx&&x86_64' - } - axis { - name 'GO_VERSION' - values '1.9' - } - } - } stages { stage('Test') { agent { label "${PLATFORM}" } diff --git a/README.md b/README.md index 95a3f58..6547c24 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ is useful outside of Elastic **_at the current stage_**, but the `licensing` pac * Apache 2.0 * Elastic +* Elastic 2.0 * Elastic Cloud ## Supported languages @@ -36,9 +37,9 @@ Options: -ext string sets the file extension to scan for. (default ".go") -license string - sets the license type to check: ASL2, Elastic, Cloud (default "ASL2") + sets the license type to check: ASL2, ASL2-Short, Cloud, Elastic, Elasticv2 (default "ASL2") -licensor string - sets the name of the licensor (default "Elasticsearch B.V.") + sets the name of the licensor (default "Elasticsearch B.V.") -version prints out the binary version. ``` diff --git a/appveyor.yml b/appveyor.yml index 2292bcb..aea89da 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,7 @@ version: "{build}" +image: Visual Studio 2019 + # Source Config clone_folder: c:\gopath\src\github.com\elastic\go-licenser @@ -7,27 +9,19 @@ clone_folder: c:\gopath\src\github.com\elastic\go-licenser # Build host environment: - GOPATH: c:\gopath - GOVERSION: 1.10 + CGO_ENABLED: 0 +stack: go 1.17 # Build install: - # Install the specific Go version. - - rmdir c:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi - - msiexec /i go%GOVERSION%.windows-amd64.msi /q - choco install bzr - - set Path=c:\go\bin;c:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path% + - set Path=C:\Users\appveyor\go\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path% - go version - go env before_build: - - go get -u golang.org/x/lint/golint - - go get -u golang.org/x/tools/cmd/goimports - - golint -set_exit_status . - - gofmt -d -e -s . - - goimports -d . + - go install build_script: - appveyor AddCompilationMessage "Starting Compilation" @@ -35,4 +29,4 @@ build_script: test_script: - go-licenser -d -exclude golden - - go test -timeout 10s -p 4 -race -cover ./... + - go test -timeout 10s -p 4 -cover ./... diff --git a/fixtures/x-pack-v2/correct.testdata b/fixtures/x-pack-v2/correct.testdata new file mode 100644 index 0000000..b805df7 --- /dev/null +++ b/fixtures/x-pack-v2/correct.testdata @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/cloud/wrong.go b/fixtures/x-pack-v2/wrong.testdata similarity index 100% rename from golden/cloud/wrong.go rename to fixtures/x-pack-v2/wrong.testdata diff --git a/fixtures/x-pack/doc.testdata b/fixtures/x-pack/correct.testdata similarity index 100% rename from fixtures/x-pack/doc.testdata rename to fixtures/x-pack/correct.testdata diff --git a/go.mod b/go.mod index 3b5df88..ae175e5 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,8 @@ module github.com/elastic/go-licenser go 1.13 require ( - golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/mod v0.3.0 // indirect - golang.org/x/tools v0.0.0-20200601175630-2caf76543d99 // indirect + golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect + golang.org/x/mod v0.5.1 // indirect + golang.org/x/sys v0.0.0-20211102192858-4dd72447c267 // indirect + golang.org/x/tools v0.1.7 // indirect ) diff --git a/go.sum b/go.sum index de380b0..7647ba0 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,33 @@ -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211102192858-4dd72447c267 h1:7zYaz3tjChtpayGDzu6H0hDAUM5zIGA2XW7kRNgQ0jc= +golang.org/x/sys v0.0.0-20211102192858-4dd72447c267/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200601175630-2caf76543d99 h1:deddXmhOJb/bvD/4M/j2AUMrhHeh6GkqykJSCWyTNVk= -golang.org/x/tools v0.0.0-20200601175630-2caf76543d99/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/golden/ASL2-Short/cloud/doc.go b/golden/ASL2-Short/cloud/doc.go new file mode 100644 index 0000000..b1e1191 --- /dev/null +++ b/golden/ASL2-Short/cloud/doc.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/ASL2-Short/cloud/wrong.go b/golden/ASL2-Short/cloud/wrong.go new file mode 100644 index 0000000..cded27b --- /dev/null +++ b/golden/ASL2-Short/cloud/wrong.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package testdata diff --git a/golden/excludedpath/file.go b/golden/ASL2-Short/excludedpath/file.go similarity index 100% rename from golden/excludedpath/file.go rename to golden/ASL2-Short/excludedpath/file.go diff --git a/golden/ASL2-Short/multilevel/doc.go b/golden/ASL2-Short/multilevel/doc.go new file mode 100644 index 0000000..b1e1191 --- /dev/null +++ b/golden/ASL2-Short/multilevel/doc.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/ASL2-Short/multilevel/main.go b/golden/ASL2-Short/multilevel/main.go new file mode 100644 index 0000000..cded27b --- /dev/null +++ b/golden/ASL2-Short/multilevel/main.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package testdata diff --git a/golden/ASL2-Short/multilevel/sublevel/autogen.go b/golden/ASL2-Short/multilevel/sublevel/autogen.go new file mode 100644 index 0000000..29d27e6 --- /dev/null +++ b/golden/ASL2-Short/multilevel/sublevel/autogen.go @@ -0,0 +1,9 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Code generated by a binary; DO NOT EDIT. + +package sublevel + +func myfunc() {} diff --git a/golden/ASL2-Short/multilevel/sublevel/doc.go b/golden/ASL2-Short/multilevel/sublevel/doc.go new file mode 100644 index 0000000..502a1dd --- /dev/null +++ b/golden/ASL2-Short/multilevel/sublevel/doc.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package sublevel holds test data for the licensing cmd +package sublevel diff --git a/golden/ASL2-Short/multilevel/sublevel/partial.go b/golden/ASL2-Short/multilevel/sublevel/partial.go new file mode 100644 index 0000000..2f47c46 --- /dev/null +++ b/golden/ASL2-Short/multilevel/sublevel/partial.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package sublevel diff --git a/golden/ASL2-Short/singlelevel/doc.go b/golden/ASL2-Short/singlelevel/doc.go new file mode 100644 index 0000000..b1e1191 --- /dev/null +++ b/golden/ASL2-Short/singlelevel/doc.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/ASL2-Short/singlelevel/main.go b/golden/ASL2-Short/singlelevel/main.go new file mode 100644 index 0000000..cded27b --- /dev/null +++ b/golden/ASL2-Short/singlelevel/main.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package testdata diff --git a/golden/ASL2-Short/singlelevel/wrapper.go b/golden/ASL2-Short/singlelevel/wrapper.go new file mode 100644 index 0000000..6e21d4b --- /dev/null +++ b/golden/ASL2-Short/singlelevel/wrapper.go @@ -0,0 +1,7 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// +build mytag + +package testdata diff --git a/golden/ASL2-Short/singlelevel/zrapper.go b/golden/ASL2-Short/singlelevel/zrapper.go new file mode 100644 index 0000000..6e21d4b --- /dev/null +++ b/golden/ASL2-Short/singlelevel/zrapper.go @@ -0,0 +1,7 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// +build mytag + +package testdata diff --git a/golden/vendor/github.com/elastic/example/file.go b/golden/ASL2-Short/vendor/github.com/elastic/example/file.go similarity index 100% rename from golden/vendor/github.com/elastic/example/file.go rename to golden/ASL2-Short/vendor/github.com/elastic/example/file.go diff --git a/golden/ASL2-Short/x-pack-v2/correct.go b/golden/ASL2-Short/x-pack-v2/correct.go new file mode 100644 index 0000000..4e9f6b1 --- /dev/null +++ b/golden/ASL2-Short/x-pack-v2/correct.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/ASL2-Short/x-pack-v2/wrong.go b/golden/ASL2-Short/x-pack-v2/wrong.go new file mode 100644 index 0000000..cded27b --- /dev/null +++ b/golden/ASL2-Short/x-pack-v2/wrong.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package testdata diff --git a/golden/ASL2-Short/x-pack/correct.go b/golden/ASL2-Short/x-pack/correct.go new file mode 100644 index 0000000..b1e1191 --- /dev/null +++ b/golden/ASL2-Short/x-pack/correct.go @@ -0,0 +1,6 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/ASL2-Short/x-pack/wrong.go b/golden/ASL2-Short/x-pack/wrong.go new file mode 100644 index 0000000..cded27b --- /dev/null +++ b/golden/ASL2-Short/x-pack/wrong.go @@ -0,0 +1,5 @@ +// Licensed to Elasticsearch B.V. under one or more agreements. +// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +package testdata diff --git a/golden/multilevel/doc.go b/golden/ASL2/cloud/doc.go similarity index 100% rename from golden/multilevel/doc.go rename to golden/ASL2/cloud/doc.go diff --git a/golden/x-pack/wrong.go b/golden/ASL2/cloud/wrong.go similarity index 100% rename from golden/x-pack/wrong.go rename to golden/ASL2/cloud/wrong.go diff --git a/golden/ASL2/excludedpath/file.go b/golden/ASL2/excludedpath/file.go new file mode 100644 index 0000000..2168920 --- /dev/null +++ b/golden/ASL2/excludedpath/file.go @@ -0,0 +1,2 @@ +// Package excludedpath holds test data for the licensing cmd +package excludedpath diff --git a/golden/singlelevel/doc.go b/golden/ASL2/multilevel/doc.go similarity index 100% rename from golden/singlelevel/doc.go rename to golden/ASL2/multilevel/doc.go diff --git a/golden/multilevel/main.go b/golden/ASL2/multilevel/main.go similarity index 100% rename from golden/multilevel/main.go rename to golden/ASL2/multilevel/main.go diff --git a/golden/multilevel/sublevel/autogen.go b/golden/ASL2/multilevel/sublevel/autogen.go similarity index 100% rename from golden/multilevel/sublevel/autogen.go rename to golden/ASL2/multilevel/sublevel/autogen.go diff --git a/golden/multilevel/sublevel/doc.go b/golden/ASL2/multilevel/sublevel/doc.go similarity index 100% rename from golden/multilevel/sublevel/doc.go rename to golden/ASL2/multilevel/sublevel/doc.go diff --git a/golden/multilevel/sublevel/partial.go b/golden/ASL2/multilevel/sublevel/partial.go similarity index 100% rename from golden/multilevel/sublevel/partial.go rename to golden/ASL2/multilevel/sublevel/partial.go diff --git a/golden/ASL2/singlelevel/doc.go b/golden/ASL2/singlelevel/doc.go new file mode 100644 index 0000000..390c51b --- /dev/null +++ b/golden/ASL2/singlelevel/doc.go @@ -0,0 +1,19 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/singlelevel/main.go b/golden/ASL2/singlelevel/main.go similarity index 100% rename from golden/singlelevel/main.go rename to golden/ASL2/singlelevel/main.go diff --git a/golden/singlelevel/wrapper.go b/golden/ASL2/singlelevel/wrapper.go similarity index 100% rename from golden/singlelevel/wrapper.go rename to golden/ASL2/singlelevel/wrapper.go diff --git a/golden/singlelevel/zrapper.go b/golden/ASL2/singlelevel/zrapper.go similarity index 100% rename from golden/singlelevel/zrapper.go rename to golden/ASL2/singlelevel/zrapper.go diff --git a/golden/ASL2/vendor/github.com/elastic/example/file.go b/golden/ASL2/vendor/github.com/elastic/example/file.go new file mode 100644 index 0000000..f7ec372 --- /dev/null +++ b/golden/ASL2/vendor/github.com/elastic/example/file.go @@ -0,0 +1 @@ +package example diff --git a/golden/ASL2/x-pack-v2/correct.go b/golden/ASL2/x-pack-v2/correct.go new file mode 100644 index 0000000..d66ebfc --- /dev/null +++ b/golden/ASL2/x-pack-v2/correct.go @@ -0,0 +1,19 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/ASL2/x-pack-v2/wrong.go b/golden/ASL2/x-pack-v2/wrong.go new file mode 100644 index 0000000..03724a5 --- /dev/null +++ b/golden/ASL2/x-pack-v2/wrong.go @@ -0,0 +1,18 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package testdata diff --git a/golden/ASL2/x-pack/correct.go b/golden/ASL2/x-pack/correct.go new file mode 100644 index 0000000..390c51b --- /dev/null +++ b/golden/ASL2/x-pack/correct.go @@ -0,0 +1,19 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/ASL2/x-pack/wrong.go b/golden/ASL2/x-pack/wrong.go new file mode 100644 index 0000000..03724a5 --- /dev/null +++ b/golden/ASL2/x-pack/wrong.go @@ -0,0 +1,18 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package testdata diff --git a/golden/cloud/doc.go b/golden/Cloud/cloud/doc.go similarity index 100% rename from golden/cloud/doc.go rename to golden/Cloud/cloud/doc.go diff --git a/golden/Cloud/cloud/wrong.go b/golden/Cloud/cloud/wrong.go new file mode 100644 index 0000000..dc23f13 --- /dev/null +++ b/golden/Cloud/cloud/wrong.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package testdata diff --git a/golden/Cloud/excludedpath/file.go b/golden/Cloud/excludedpath/file.go new file mode 100644 index 0000000..2168920 --- /dev/null +++ b/golden/Cloud/excludedpath/file.go @@ -0,0 +1,2 @@ +// Package excludedpath holds test data for the licensing cmd +package excludedpath diff --git a/golden/Cloud/multilevel/doc.go b/golden/Cloud/multilevel/doc.go new file mode 100644 index 0000000..c067a1a --- /dev/null +++ b/golden/Cloud/multilevel/doc.go @@ -0,0 +1,17 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Cloud/multilevel/main.go b/golden/Cloud/multilevel/main.go new file mode 100644 index 0000000..dc23f13 --- /dev/null +++ b/golden/Cloud/multilevel/main.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package testdata diff --git a/golden/Cloud/multilevel/sublevel/autogen.go b/golden/Cloud/multilevel/sublevel/autogen.go new file mode 100644 index 0000000..329c1d7 --- /dev/null +++ b/golden/Cloud/multilevel/sublevel/autogen.go @@ -0,0 +1,20 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Code generated by a binary; DO NOT EDIT. + +package sublevel + +func myfunc() {} diff --git a/golden/Cloud/multilevel/sublevel/doc.go b/golden/Cloud/multilevel/sublevel/doc.go new file mode 100644 index 0000000..0d44d86 --- /dev/null +++ b/golden/Cloud/multilevel/sublevel/doc.go @@ -0,0 +1,17 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Package sublevel holds test data for the licensing cmd +package sublevel diff --git a/golden/Cloud/multilevel/sublevel/partial.go b/golden/Cloud/multilevel/sublevel/partial.go new file mode 100644 index 0000000..9f0ed7e --- /dev/null +++ b/golden/Cloud/multilevel/sublevel/partial.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package sublevel diff --git a/golden/Cloud/singlelevel/doc.go b/golden/Cloud/singlelevel/doc.go new file mode 100644 index 0000000..c067a1a --- /dev/null +++ b/golden/Cloud/singlelevel/doc.go @@ -0,0 +1,17 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Cloud/singlelevel/main.go b/golden/Cloud/singlelevel/main.go new file mode 100644 index 0000000..dc23f13 --- /dev/null +++ b/golden/Cloud/singlelevel/main.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package testdata diff --git a/golden/Cloud/singlelevel/wrapper.go b/golden/Cloud/singlelevel/wrapper.go new file mode 100644 index 0000000..c24a622 --- /dev/null +++ b/golden/Cloud/singlelevel/wrapper.go @@ -0,0 +1,18 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// +build mytag + +package testdata diff --git a/golden/Cloud/singlelevel/zrapper.go b/golden/Cloud/singlelevel/zrapper.go new file mode 100644 index 0000000..c24a622 --- /dev/null +++ b/golden/Cloud/singlelevel/zrapper.go @@ -0,0 +1,18 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// +build mytag + +package testdata diff --git a/golden/Cloud/vendor/github.com/elastic/example/file.go b/golden/Cloud/vendor/github.com/elastic/example/file.go new file mode 100644 index 0000000..f7ec372 --- /dev/null +++ b/golden/Cloud/vendor/github.com/elastic/example/file.go @@ -0,0 +1 @@ +package example diff --git a/golden/Cloud/x-pack-v2/correct.go b/golden/Cloud/x-pack-v2/correct.go new file mode 100644 index 0000000..697d82b --- /dev/null +++ b/golden/Cloud/x-pack-v2/correct.go @@ -0,0 +1,17 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/Cloud/x-pack-v2/wrong.go b/golden/Cloud/x-pack-v2/wrong.go new file mode 100644 index 0000000..dc23f13 --- /dev/null +++ b/golden/Cloud/x-pack-v2/wrong.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package testdata diff --git a/golden/Cloud/x-pack/correct.go b/golden/Cloud/x-pack/correct.go new file mode 100644 index 0000000..c067a1a --- /dev/null +++ b/golden/Cloud/x-pack/correct.go @@ -0,0 +1,17 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Cloud/x-pack/wrong.go b/golden/Cloud/x-pack/wrong.go new file mode 100644 index 0000000..dc23f13 --- /dev/null +++ b/golden/Cloud/x-pack/wrong.go @@ -0,0 +1,16 @@ +// ELASTICSEARCH CONFIDENTIAL +// __________________ +// +// Copyright Elasticsearch B.V. All rights reserved. +// +// NOTICE: All information contained herein is, and remains +// the property of Elasticsearch B.V. and its suppliers, if any. +// The intellectual and technical concepts contained herein +// are proprietary to Elasticsearch B.V. and its suppliers and +// may be covered by U.S. and Foreign Patents, patents in +// process, and are protected by trade secret or copyright +// law. Dissemination of this information or reproduction of +// this material is strictly forbidden unless prior written +// permission is obtained from Elasticsearch B.V. + +package testdata diff --git a/golden/x-pack/doc.go b/golden/Elastic/cloud/doc.go similarity index 100% rename from golden/x-pack/doc.go rename to golden/Elastic/cloud/doc.go diff --git a/golden/Elastic/cloud/wrong.go b/golden/Elastic/cloud/wrong.go new file mode 100644 index 0000000..3aba916 --- /dev/null +++ b/golden/Elastic/cloud/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package testdata diff --git a/golden/Elastic/excludedpath/file.go b/golden/Elastic/excludedpath/file.go new file mode 100644 index 0000000..2168920 --- /dev/null +++ b/golden/Elastic/excludedpath/file.go @@ -0,0 +1,2 @@ +// Package excludedpath holds test data for the licensing cmd +package excludedpath diff --git a/golden/Elastic/multilevel/doc.go b/golden/Elastic/multilevel/doc.go new file mode 100644 index 0000000..73c6292 --- /dev/null +++ b/golden/Elastic/multilevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elastic/multilevel/main.go b/golden/Elastic/multilevel/main.go new file mode 100644 index 0000000..3aba916 --- /dev/null +++ b/golden/Elastic/multilevel/main.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package testdata diff --git a/golden/Elastic/multilevel/sublevel/autogen.go b/golden/Elastic/multilevel/sublevel/autogen.go new file mode 100644 index 0000000..c59501c --- /dev/null +++ b/golden/Elastic/multilevel/sublevel/autogen.go @@ -0,0 +1,9 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Code generated by a binary; DO NOT EDIT. + +package sublevel + +func myfunc() {} diff --git a/golden/Elastic/multilevel/sublevel/doc.go b/golden/Elastic/multilevel/sublevel/doc.go new file mode 100644 index 0000000..fc36884 --- /dev/null +++ b/golden/Elastic/multilevel/sublevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Package sublevel holds test data for the licensing cmd +package sublevel diff --git a/golden/Elastic/multilevel/sublevel/partial.go b/golden/Elastic/multilevel/sublevel/partial.go new file mode 100644 index 0000000..82b9ef5 --- /dev/null +++ b/golden/Elastic/multilevel/sublevel/partial.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package sublevel diff --git a/golden/Elastic/singlelevel/doc.go b/golden/Elastic/singlelevel/doc.go new file mode 100644 index 0000000..73c6292 --- /dev/null +++ b/golden/Elastic/singlelevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elastic/singlelevel/main.go b/golden/Elastic/singlelevel/main.go new file mode 100644 index 0000000..3aba916 --- /dev/null +++ b/golden/Elastic/singlelevel/main.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package testdata diff --git a/golden/Elastic/singlelevel/wrapper.go b/golden/Elastic/singlelevel/wrapper.go new file mode 100644 index 0000000..476e437 --- /dev/null +++ b/golden/Elastic/singlelevel/wrapper.go @@ -0,0 +1,7 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// +build mytag + +package testdata diff --git a/golden/Elastic/singlelevel/zrapper.go b/golden/Elastic/singlelevel/zrapper.go new file mode 100644 index 0000000..476e437 --- /dev/null +++ b/golden/Elastic/singlelevel/zrapper.go @@ -0,0 +1,7 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// +build mytag + +package testdata diff --git a/golden/Elastic/vendor/github.com/elastic/example/file.go b/golden/Elastic/vendor/github.com/elastic/example/file.go new file mode 100644 index 0000000..f7ec372 --- /dev/null +++ b/golden/Elastic/vendor/github.com/elastic/example/file.go @@ -0,0 +1 @@ +package example diff --git a/golden/Elastic/x-pack-v2/correct.go b/golden/Elastic/x-pack-v2/correct.go new file mode 100644 index 0000000..35ac788 --- /dev/null +++ b/golden/Elastic/x-pack-v2/correct.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/Elastic/x-pack-v2/wrong.go b/golden/Elastic/x-pack-v2/wrong.go new file mode 100644 index 0000000..3aba916 --- /dev/null +++ b/golden/Elastic/x-pack-v2/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package testdata diff --git a/golden/Elastic/x-pack/correct.go b/golden/Elastic/x-pack/correct.go new file mode 100644 index 0000000..73c6292 --- /dev/null +++ b/golden/Elastic/x-pack/correct.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elastic/x-pack/wrong.go b/golden/Elastic/x-pack/wrong.go new file mode 100644 index 0000000..3aba916 --- /dev/null +++ b/golden/Elastic/x-pack/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package testdata diff --git a/golden/Elasticv2/cloud/doc.go b/golden/Elasticv2/cloud/doc.go new file mode 100644 index 0000000..7096cab --- /dev/null +++ b/golden/Elasticv2/cloud/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elasticv2/cloud/wrong.go b/golden/Elasticv2/cloud/wrong.go new file mode 100644 index 0000000..23cc851 --- /dev/null +++ b/golden/Elasticv2/cloud/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package testdata diff --git a/golden/Elasticv2/excludedpath/file.go b/golden/Elasticv2/excludedpath/file.go new file mode 100644 index 0000000..2168920 --- /dev/null +++ b/golden/Elasticv2/excludedpath/file.go @@ -0,0 +1,2 @@ +// Package excludedpath holds test data for the licensing cmd +package excludedpath diff --git a/golden/Elasticv2/multilevel/doc.go b/golden/Elasticv2/multilevel/doc.go new file mode 100644 index 0000000..7096cab --- /dev/null +++ b/golden/Elasticv2/multilevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elasticv2/multilevel/main.go b/golden/Elasticv2/multilevel/main.go new file mode 100644 index 0000000..23cc851 --- /dev/null +++ b/golden/Elasticv2/multilevel/main.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package testdata diff --git a/golden/Elasticv2/multilevel/sublevel/autogen.go b/golden/Elasticv2/multilevel/sublevel/autogen.go new file mode 100644 index 0000000..e9eb0ce --- /dev/null +++ b/golden/Elasticv2/multilevel/sublevel/autogen.go @@ -0,0 +1,9 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Code generated by a binary; DO NOT EDIT. + +package sublevel + +func myfunc() {} diff --git a/golden/Elasticv2/multilevel/sublevel/doc.go b/golden/Elasticv2/multilevel/sublevel/doc.go new file mode 100644 index 0000000..5647d0e --- /dev/null +++ b/golden/Elasticv2/multilevel/sublevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package sublevel holds test data for the licensing cmd +package sublevel diff --git a/golden/Elasticv2/multilevel/sublevel/partial.go b/golden/Elasticv2/multilevel/sublevel/partial.go new file mode 100644 index 0000000..116d884 --- /dev/null +++ b/golden/Elasticv2/multilevel/sublevel/partial.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package sublevel diff --git a/golden/Elasticv2/singlelevel/doc.go b/golden/Elasticv2/singlelevel/doc.go new file mode 100644 index 0000000..7096cab --- /dev/null +++ b/golden/Elasticv2/singlelevel/doc.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elasticv2/singlelevel/main.go b/golden/Elasticv2/singlelevel/main.go new file mode 100644 index 0000000..23cc851 --- /dev/null +++ b/golden/Elasticv2/singlelevel/main.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package testdata diff --git a/golden/Elasticv2/singlelevel/wrapper.go b/golden/Elasticv2/singlelevel/wrapper.go new file mode 100644 index 0000000..9855e55 --- /dev/null +++ b/golden/Elasticv2/singlelevel/wrapper.go @@ -0,0 +1,7 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// +build mytag + +package testdata diff --git a/golden/Elasticv2/singlelevel/zrapper.go b/golden/Elasticv2/singlelevel/zrapper.go new file mode 100644 index 0000000..9855e55 --- /dev/null +++ b/golden/Elasticv2/singlelevel/zrapper.go @@ -0,0 +1,7 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// +build mytag + +package testdata diff --git a/golden/Elasticv2/vendor/github.com/elastic/example/file.go b/golden/Elasticv2/vendor/github.com/elastic/example/file.go new file mode 100644 index 0000000..f7ec372 --- /dev/null +++ b/golden/Elasticv2/vendor/github.com/elastic/example/file.go @@ -0,0 +1 @@ +package example diff --git a/golden/Elasticv2/x-pack-v2/correct.go b/golden/Elasticv2/x-pack-v2/correct.go new file mode 100644 index 0000000..b805df7 --- /dev/null +++ b/golden/Elasticv2/x-pack-v2/correct.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata \ No newline at end of file diff --git a/golden/Elasticv2/x-pack-v2/wrong.go b/golden/Elasticv2/x-pack-v2/wrong.go new file mode 100644 index 0000000..23cc851 --- /dev/null +++ b/golden/Elasticv2/x-pack-v2/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package testdata diff --git a/golden/Elasticv2/x-pack/correct.go b/golden/Elasticv2/x-pack/correct.go new file mode 100644 index 0000000..7096cab --- /dev/null +++ b/golden/Elasticv2/x-pack/correct.go @@ -0,0 +1,6 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package testdata holds test data for the licensing cmd +package testdata diff --git a/golden/Elasticv2/x-pack/wrong.go b/golden/Elasticv2/x-pack/wrong.go new file mode 100644 index 0000000..23cc851 --- /dev/null +++ b/golden/Elasticv2/x-pack/wrong.go @@ -0,0 +1,5 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package testdata diff --git a/licensing/license.go b/licensing/license.go index 3351092..97e6724 100644 --- a/licensing/license.go +++ b/licensing/license.go @@ -29,7 +29,7 @@ import ( ) var ( - startPrefixes = []string{"// Copyright", "// copyright", "// Licensed", "// licensed"} + startPrefixes = []string{"// Copyright", "// copyright", "// Licensed", "// licensed", "// ELASTICSEARCH CONFIDENTIAL"} endPrefixes = []string{"package ", "// Package ", "// +build ", "// Code generated", "// code generated"} errHeaderIsTooShort = errors.New("header is too short") diff --git a/main.go b/main.go index 16c4424..928ed47 100644 --- a/main.go +++ b/main.go @@ -88,6 +88,11 @@ var Headers = map[string][]string{ `// or more contributor license agreements. Licensed under the Elastic License;`, `// you may not use this file except in compliance with the Elastic License.`, }, + "Elasticv2": { + `// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one`, + `// or more contributor license agreements. Licensed under the Elastic License 2.0;`, + `// you may not use this file except in compliance with the Elastic License 2.0.`, + }, "Cloud": { `// ELASTICSEARCH CONFIDENTIAL`, `// __________________`, diff --git a/main_test.go b/main_test.go index c56f449..b9514f5 100644 --- a/main_test.go +++ b/main_test.go @@ -51,7 +51,7 @@ func Test_run(t *testing.T) { args: []string{"testdata"}, license: defaultLicense, licensor: defaultLicensor, - exclude: []string{"excludedpath", "x-pack", "cloud"}, + exclude: []string{"excludedpath", "x-pack", "x-pack-v2", "cloud"}, ext: defaultExt, dry: true, }, @@ -93,6 +93,37 @@ testdata/singlelevel/main.go: is missing the license header testdata/singlelevel/wrapper.go: is missing the license header testdata/singlelevel/zrapper.go: is missing the license header testdata/x-pack/wrong.go: is missing the license header +testdata/x-pack-v2/correct.go: is missing the license header +testdata/x-pack-v2/wrong.go: is missing the license header +`[1:], + }, + { + name: "Run a diff prints a list of files that need the Elastic license 2.0 header", + args: args{ + args: []string{"testdata"}, + license: "Elasticv2", + licensor: defaultLicensor, + ext: defaultExt, + dry: true, + }, + want: 1, + err: &Error{code: 1}, + wantOutput: ` +testdata/cloud/doc.go: is missing the license header +testdata/cloud/wrong.go: is missing the license header +testdata/excludedpath/file.go: is missing the license header +testdata/multilevel/doc.go: is missing the license header +testdata/multilevel/main.go: is missing the license header +testdata/multilevel/sublevel/autogen.go: is missing the license header +testdata/multilevel/sublevel/doc.go: is missing the license header +testdata/multilevel/sublevel/partial.go: is missing the license header +testdata/singlelevel/doc.go: is missing the license header +testdata/singlelevel/main.go: is missing the license header +testdata/singlelevel/wrapper.go: is missing the license header +testdata/singlelevel/zrapper.go: is missing the license header +testdata/x-pack/correct.go: is missing the license header +testdata/x-pack/wrong.go: is missing the license header +testdata/x-pack-v2/wrong.go: is missing the license header `[1:], }, { @@ -118,8 +149,10 @@ testdata/singlelevel/doc.go: is missing the license header testdata/singlelevel/main.go: is missing the license header testdata/singlelevel/wrapper.go: is missing the license header testdata/singlelevel/zrapper.go: is missing the license header -testdata/x-pack/doc.go: is missing the license header +testdata/x-pack/correct.go: is missing the license header testdata/x-pack/wrong.go: is missing the license header +testdata/x-pack-v2/correct.go: is missing the license header +testdata/x-pack-v2/wrong.go: is missing the license header `[1:], }, { @@ -147,12 +180,64 @@ testdata/x-pack/wrong.go: is missing the license header err: &Error{err: errors.New("unknown license: foo"), code: 7}, }, { - name: "Run with default mode rewrites the source files", + name: "Check ASL2 license rewrite", args: args{ args: []string{"testdata"}, license: defaultLicense, licensor: defaultLicensor, - exclude: []string{"excludedpath", "x-pack", "cloud"}, + exclude: []string{"excludedpath"}, + ext: defaultExt, + dry: false, + }, + want: 0, + wantGolden: true, + }, + { + name: "Check ASL2-short license rewrite", + args: args{ + args: []string{"testdata"}, + license: "ASL2-Short", + licensor: defaultLicensor, + exclude: []string{"excludedpath"}, + ext: defaultExt, + dry: false, + }, + want: 0, + wantGolden: true, + }, + { + name: "Check Cloud license rewrite", + args: args{ + args: []string{"testdata"}, + license: "Cloud", + licensor: defaultLicensor, + exclude: []string{"excludedpath"}, + ext: defaultExt, + dry: false, + }, + want: 0, + wantGolden: true, + }, + { + name: "Check Elastic license rewrite", + args: args{ + args: []string{"testdata"}, + license: "Elastic", + licensor: defaultLicensor, + exclude: []string{"excludedpath"}, + ext: defaultExt, + dry: false, + }, + want: 0, + wantGolden: true, + }, + { + name: "Check Elastic 2.0 license rewrite", + args: args{ + args: []string{"testdata"}, + license: "Elasticv2", + licensor: defaultLicensor, + exclude: []string{"excludedpath"}, ext: defaultExt, dry: false, }, @@ -185,13 +270,14 @@ testdata/x-pack/wrong.go: is missing the license header } if tt.wantGolden { + goldenDirectory := filepath.Join("golden", tt.args.license) if *update { - copyFixtures(t, "golden") - if err := run([]string{"golden"}, tt.args.license, tt.args.licensor, tt.args.exclude, tt.args.ext, tt.args.dry, buf); err != nil { + copyFixtures(t, goldenDirectory) + if err := run([]string{goldenDirectory}, tt.args.license, tt.args.licensor, tt.args.exclude, tt.args.ext, tt.args.dry, buf); err != nil { t.Fatal(err) } } - hashDirectories(t, "testdata", "golden") + hashDirectories(t, "testdata", goldenDirectory) } }) } diff --git a/testhelpers.go b/testhelpers.go index fc18c61..37b25b9 100644 --- a/testhelpers.go +++ b/testhelpers.go @@ -130,7 +130,7 @@ func hashDirectories(t *testing.T, src, dest string) { t.Log("===========================") var srcSum, dstSum = srcHash.Sum(nil), dstHash.Sum(nil) - if bytes.Compare(srcSum, dstSum) > 0 { + if bytes.Compare(srcSum, dstSum) != 0 { t.Errorf("Contents of %s are not the same as %s", src, dest) t.Errorf("src folder hash: %x", srcSum) t.Errorf("dst folder hash: %x", dstSum)