From e0d36d14bcd0f472a13c576b6541e361c9620c4b Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Wed, 30 Nov 2022 19:25:19 -0500 Subject: [PATCH] rename spdx package expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the rename of spdx-expressions repo to go-spdx, the name of the package reads better as expression. This allows for future changes to the API be something likeā€¦ go-spdx/expression - validation of expressions go-spdx/license - validation of licenses go-spdx/parse - parsing This naming scheme more closely aligns with go conventions. --- CONTRIBUTING.md | 6 +++--- README.md | 2 +- SUPPORT.md | 6 +++--- {spdxexp => expression}/compare.go | 2 +- {spdxexp => expression}/compare_test.go | 2 +- expression/doc.go | 7 +++++++ {spdxexp => expression}/license.go | 2 +- {spdxexp => expression}/license_test.go | 2 +- {spdxexp => expression}/node.go | 2 +- {spdxexp => expression}/node_test.go | 2 +- {spdxexp => expression}/parse.go | 2 +- {spdxexp => expression}/parse_test.go | 2 +- {spdxexp => expression}/satisfies.go | 2 +- {spdxexp => expression}/satisfies_test.go | 4 ++-- {spdxexp => expression}/scan.go | 2 +- {spdxexp => expression}/scan_test.go | 2 +- {spdxexp => expression}/test_helper.go | 2 +- go.mod | 2 +- spdxexp/doc.go | 7 ------- 19 files changed, 29 insertions(+), 29 deletions(-) rename {spdxexp => expression}/compare.go (98%) rename {spdxexp => expression}/compare_test.go (99%) create mode 100644 expression/doc.go rename {spdxexp => expression}/license.go (99%) rename {spdxexp => expression}/license_test.go (99%) rename {spdxexp => expression}/node.go (99%) rename {spdxexp => expression}/node_test.go (99%) rename {spdxexp => expression}/parse.go (99%) rename {spdxexp => expression}/parse_test.go (99%) rename {spdxexp => expression}/satisfies.go (99%) rename {spdxexp => expression}/satisfies_test.go (99%) rename {spdxexp => expression}/scan.go (99%) rename {spdxexp => expression}/scan_test.go (99%) rename {spdxexp => expression}/test_helper.go (97%) delete mode 100644 spdxexp/doc.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3032c1d..d14a6b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ ## Contributing -[fork]: https://github.com/github/spdx-expression/fork -[pr]: https://github.com/github/spdx-expression/compare -[style]: https://github.com/github/spdx-expression/blob/main/.golangci.yaml +[fork]: https://github.com/github/go-spdx +[pr]: https://github.com/github/go-spdx/compare +[style]: https://github.com/github/go-spdx/blob/main/.golangci.yaml [code-of-conduct]: CODE_OF_CONDUCT.md Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. diff --git a/README.md b/README.md index 012fc31..2a1adcd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# spdx-expression +# go-spdx Golang implementation of a checker for determining if a set of SPDX IDs satisfies an SPDX Expression. diff --git a/SUPPORT.md b/SUPPORT.md index 88cd8ef..34f18da 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -2,10 +2,10 @@ ## How to file issues and get help -This project uses GitHub [issues](https://github.com/github/spdx-expression/issues) to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. If not found, file your bug or feaure request as a new issue. +This project uses GitHub [issues](https://github.com/github/go-spdx/issues) to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. If not found, file your bug or feaure request as a new issue. -For help or questions about using this project, please see the project [Discussions](https://github.com/github/spdx-expression/discussions) where you can ask a question in [Q&A](https://github.com/github/spdx-expression/discussions/categories/q-a), propose an idea in [Ideas](https://github.com/github/spdx-expression/discussions/categories/ideas), or share your work in [Show and Tell](https://github.com/github/spdx-expression/discussions/categories/show-and-tell). +For help or questions about using this project, please see the project [Discussions](https://github.com/github/go-spdx/discussions) where you can ask a question in [Q&A](https://github.com/github/go-spdx/discussions/categories/q-a), propose an idea in [Ideas](https://github.com/github/go-spdx/discussions/categories/ideas), or share your work in [Show and Tell](https://github.com/github/go-spdx/discussions/categories/show-and-tell). -The spdx-expression package is under active development and maintained by GitHub staff. Community [contributions](./CONTRIBUTING.md) are always welcome. We will do our best to respond to issues, feature requests, and community questions in a timely manner. +The go-spdx package is under active development and maintained by GitHub staff. Community [contributions](./CONTRIBUTING.md) are always welcome. We will do our best to respond to issues, feature requests, and community questions in a timely manner. Support for this project is limited to the resources listed above. diff --git a/spdxexp/compare.go b/expression/compare.go similarity index 98% rename from spdxexp/compare.go rename to expression/compare.go index 3c77a53..b6605ab 100644 --- a/spdxexp/compare.go +++ b/expression/compare.go @@ -1,4 +1,4 @@ -package spdxexp +package expression func compareGT(first *node, second *node) bool { if !first.isLicense() || !second.isLicense() { diff --git a/spdxexp/compare_test.go b/expression/compare_test.go similarity index 99% rename from spdxexp/compare_test.go rename to expression/compare_test.go index 16f00d1..3518ae5 100644 --- a/spdxexp/compare_test.go +++ b/expression/compare_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "testing" diff --git a/expression/doc.go b/expression/doc.go new file mode 100644 index 0000000..0b23cb5 --- /dev/null +++ b/expression/doc.go @@ -0,0 +1,7 @@ +/* +Expression package validates licenses and determines if a license expression is satisfied by a list of licenses. +Validity of a license is determined by the [SPDX license list]. + +[SPDX license list]: https://spdx.org/licenses/ +*/ +package expression diff --git a/spdxexp/license.go b/expression/license.go similarity index 99% rename from spdxexp/license.go rename to expression/license.go index 6c521ab..81dcbc1 100644 --- a/spdxexp/license.go +++ b/expression/license.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "strings" diff --git a/spdxexp/license_test.go b/expression/license_test.go similarity index 99% rename from spdxexp/license_test.go rename to expression/license_test.go index 636c48e..ceebee5 100644 --- a/spdxexp/license_test.go +++ b/expression/license_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "testing" diff --git a/spdxexp/node.go b/expression/node.go similarity index 99% rename from spdxexp/node.go rename to expression/node.go index 10c6308..51a89f3 100644 --- a/spdxexp/node.go +++ b/expression/node.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "sort" diff --git a/spdxexp/node_test.go b/expression/node_test.go similarity index 99% rename from spdxexp/node_test.go rename to expression/node_test.go index 4cabd47..0772494 100644 --- a/spdxexp/node_test.go +++ b/expression/node_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "testing" diff --git a/spdxexp/parse.go b/expression/parse.go similarity index 99% rename from spdxexp/parse.go rename to expression/parse.go index f1ce306..28fcd0f 100644 --- a/spdxexp/parse.go +++ b/expression/parse.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "errors" diff --git a/spdxexp/parse_test.go b/expression/parse_test.go similarity index 99% rename from spdxexp/parse_test.go rename to expression/parse_test.go index 15cdb2a..c7b5497 100644 --- a/spdxexp/parse_test.go +++ b/expression/parse_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "errors" diff --git a/spdxexp/satisfies.go b/expression/satisfies.go similarity index 99% rename from spdxexp/satisfies.go rename to expression/satisfies.go index abd4778..dac0a82 100644 --- a/spdxexp/satisfies.go +++ b/expression/satisfies.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "errors" diff --git a/spdxexp/satisfies_test.go b/expression/satisfies_test.go similarity index 99% rename from spdxexp/satisfies_test.go rename to expression/satisfies_test.go index ebf467d..6dbf324 100644 --- a/spdxexp/satisfies_test.go +++ b/expression/satisfies_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "errors" @@ -31,7 +31,7 @@ func TestValidateLicenses(t *testing.T) { // TestSatisfiesSingle lets you quickly test a single call to Satisfies with a specific license expression and allowed list of licenses. // To test a different expression, change the expression, allowed licenses, and expected result in the function body. -// TO RUN: go test ./spdxexp -run TestSatisfiesSingle +// TO RUN: go test ./expression -run TestSatisfiesSingle func TestSatisfiesSingle(t *testing.T) { // Update these to test a different expression. expression := "BSD-3-Clause AND GPL-2.0" diff --git a/spdxexp/scan.go b/expression/scan.go similarity index 99% rename from spdxexp/scan.go rename to expression/scan.go index 0af567c..0cb53ea 100644 --- a/spdxexp/scan.go +++ b/expression/scan.go @@ -1,4 +1,4 @@ -package spdxexp +package expression /* Translation to Go from javascript code: https://github.com/clearlydefined/spdx-expression-parse.js/blob/master/scan.js */ diff --git a/spdxexp/scan_test.go b/expression/scan_test.go similarity index 99% rename from spdxexp/scan_test.go rename to expression/scan_test.go index 266ec62..8404488 100644 --- a/spdxexp/scan_test.go +++ b/expression/scan_test.go @@ -1,4 +1,4 @@ -package spdxexp +package expression import ( "errors" diff --git a/spdxexp/test_helper.go b/expression/test_helper.go similarity index 97% rename from spdxexp/test_helper.go rename to expression/test_helper.go index ce439e2..2a3cd74 100644 --- a/spdxexp/test_helper.go +++ b/expression/test_helper.go @@ -1,4 +1,4 @@ -package spdxexp +package expression // getLicenseNode is a test helper method that is expected to create a valid // license node. Use this function when the test data is known to be a valid diff --git a/go.mod b/go.mod index 475873b..30df589 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/github/spdx-expression +module github.com/github/go-spdx go 1.18 diff --git a/spdxexp/doc.go b/spdxexp/doc.go deleted file mode 100644 index f487539..0000000 --- a/spdxexp/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -/* -Spdxexp package validates licenses and determines if a license expression is satisfied by a list of licenses. -Validity of a license is determined by the [SPDX license list]. - -[SPDX license list]: https://spdx.org/licenses/ -*/ -package spdxexp