Skip to content

Commit

Permalink
Merge pull request #27 from github/elr/refactor-to-spdxexp
Browse files Browse the repository at this point in the history
rename package from expression to spdxexp
  • Loading branch information
elrayle authored Dec 1, 2022
2 parents 82503af + 9374645 commit cf11334
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 21 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

Golang implementation of a checker for determining if a set of SPDX IDs satisfies an SPDX Expression.

## Installation

There are several ways to include a go package. To download and install, you can use `go get`. The command for that is:

```sh
go get github.com/github/go-spdx@latest
```

## Packages

- [spdxexp](https://pkg.go.dev/github.com/github/go-spdx/spdxexp) - 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.

## Public API

_NOTE: The public API is initially limited to the Satisfies and ValidateLicenses functions. If
Expand Down
7 changes: 0 additions & 7 deletions expression/doc.go

This file was deleted.

2 changes: 1 addition & 1 deletion expression/compare.go → spdxexp/compare.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

func compareGT(first *node, second *node) bool {
if !first.isLicense() || !second.isLicense() {
Expand Down
2 changes: 1 addition & 1 deletion expression/compare_test.go → spdxexp/compare_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"testing"
Expand Down
7 changes: 7 additions & 0 deletions spdxexp/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
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
2 changes: 1 addition & 1 deletion expression/license.go → spdxexp/license.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"strings"
Expand Down
2 changes: 1 addition & 1 deletion expression/license_test.go → spdxexp/license_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"testing"
Expand Down
4 changes: 2 additions & 2 deletions expression/node.go → spdxexp/node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"sort"
Expand Down Expand Up @@ -167,7 +167,7 @@ func (n *node) reconstructedLicenseString() *string {
return nil
}

// Sort an array of license and license reference nodes alphebetically based
// Sort an array of license and license reference nodes alphabetically based
// on their reconstructedLicenseString() representation. The sort function does not expect
// expression nodes, but if one is in the nodes list, it will sort to the end.
func sortLicenses(nodes []*node) {
Expand Down
2 changes: 1 addition & 1 deletion expression/node_test.go → spdxexp/node_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion expression/parse.go → spdxexp/parse.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion expression/parse_test.go → spdxexp/parse_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion expression/satisfies.go → spdxexp/satisfies.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion expression/satisfies_test.go → spdxexp/satisfies_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion expression/scan.go → spdxexp/scan.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

/* Translation to Go from javascript code: https://github.com/clearlydefined/spdx-expression-parse.js/blob/master/scan.js */

Expand Down
2 changes: 1 addition & 1 deletion expression/scan_test.go → spdxexp/scan_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion expression/test_helper.go → spdxexp/test_helper.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package expression
package spdxexp

// 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
Expand Down

0 comments on commit cf11334

Please sign in to comment.