Merge changes I3db6310e,I061be2b9,I7e81936d,If0684cf1,I404b138f

* changes:
  Move compliance commands into subdirectories
  Give compliance a pkgPath
  Move policy subdirectory into package directory
  Fix errors caught by go vet in compliance package
  Run gofmt on compliance
diff --git a/tools/compliance/Android.bp b/tools/compliance/Android.bp
index 8bae317..7037670 100644
--- a/tools/compliance/Android.bp
+++ b/tools/compliance/Android.bp
@@ -19,58 +19,58 @@
 
 blueprint_go_binary {
     name: "bom",
-    srcs: ["cmd/bom.go"],
+    srcs: ["cmd/bom/bom.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/bom_test.go"],
+    testSrcs: ["cmd/bom/bom_test.go"],
 }
 
 blueprint_go_binary {
     name: "checkshare",
-    srcs: ["cmd/checkshare.go"],
+    srcs: ["cmd/checkshare/checkshare.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/checkshare_test.go"],
+    testSrcs: ["cmd/checkshare/checkshare_test.go"],
 }
 
 blueprint_go_binary {
     name: "listshare",
-    srcs: ["cmd/listshare.go"],
+    srcs: ["cmd/listshare/listshare.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/listshare_test.go"],
+    testSrcs: ["cmd/listshare/listshare_test.go"],
 }
 
 blueprint_go_binary {
     name: "dumpgraph",
-    srcs: ["cmd/dumpgraph.go"],
+    srcs: ["cmd/dumpgraph/dumpgraph.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/dumpgraph_test.go"],
+    testSrcs: ["cmd/dumpgraph/dumpgraph_test.go"],
 }
 
 blueprint_go_binary {
     name: "dumpresolutions",
-    srcs: ["cmd/dumpresolutions.go"],
+    srcs: ["cmd/dumpresolutions/dumpresolutions.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/dumpresolutions_test.go"],
+    testSrcs: ["cmd/dumpresolutions/dumpresolutions_test.go"],
 }
 
 blueprint_go_binary {
     name: "htmlnotice",
-    srcs: ["cmd/htmlnotice.go"],
+    srcs: ["cmd/htmlnotice/htmlnotice.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/htmlnotice_test.go"],
+    testSrcs: ["cmd/htmlnotice/htmlnotice_test.go"],
 }
 
 blueprint_go_binary {
     name: "shippedlibs",
-    srcs: ["cmd/shippedlibs.go"],
+    srcs: ["cmd/shippedlibs/shippedlibs.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/shippedlibs_test.go"],
+    testSrcs: ["cmd/shippedlibs/shippedlibs_test.go"],
 }
 
 blueprint_go_binary {
     name: "textnotice",
-    srcs: ["cmd/textnotice.go"],
+    srcs: ["cmd/textnotice/textnotice.go"],
     deps: ["compliance-module"],
-    testSrcs: ["cmd/textnotice_test.go"],
+    testSrcs: ["cmd/textnotice/textnotice_test.go"],
 }
 
 bootstrap_go_package {
@@ -81,14 +81,14 @@
         "doc.go",
         "graph.go",
         "noticeindex.go",
-        "policy/policy.go",
-        "policy/resolve.go",
-        "policy/resolvenotices.go",
-        "policy/resolveshare.go",
-        "policy/resolveprivacy.go",
-        "policy/shareprivacyconflicts.go",
-        "policy/shipped.go",
-        "policy/walk.go",
+        "policy_policy.go",
+        "policy_resolve.go",
+        "policy_resolvenotices.go",
+        "policy_resolveshare.go",
+        "policy_resolveprivacy.go",
+        "policy_shareprivacyconflicts.go",
+        "policy_shipped.go",
+        "policy_walk.go",
         "readgraph.go",
         "resolution.go",
         "resolutionset.go",
@@ -97,14 +97,14 @@
         "condition_test.go",
         "conditionset_test.go",
         "readgraph_test.go",
-        "policy/policy_test.go",
-        "policy/resolve_test.go",
-        "policy/resolvenotices_test.go",
-        "policy/resolveshare_test.go",
-        "policy/resolveprivacy_test.go",
-        "policy/shareprivacyconflicts_test.go",
-        "policy/shipped_test.go",
-        "policy/walk_test.go",
+        "policy_policy_test.go",
+        "policy_resolve_test.go",
+        "policy_resolvenotices_test.go",
+        "policy_resolveshare_test.go",
+        "policy_resolveprivacy_test.go",
+        "policy_shareprivacyconflicts_test.go",
+        "policy_shipped_test.go",
+        "policy_walk_test.go",
         "resolutionset_test.go",
         "test_util.go",
     ],
@@ -113,5 +113,5 @@
         "golang-protobuf-encoding-prototext",
         "license_metadata_proto",
     ],
-    pkgPath: "compliance",
+    pkgPath: "android/soong/tools/compliance",
 }
diff --git a/tools/compliance/cmd/bom.go b/tools/compliance/cmd/bom/bom.go
similarity index 93%
rename from tools/compliance/cmd/bom.go
rename to tools/compliance/cmd/bom/bom.go
index f6cb72c..aaec786 100644
--- a/tools/compliance/cmd/bom.go
+++ b/tools/compliance/cmd/bom/bom.go
@@ -16,7 +16,6 @@
 
 import (
 	"bytes"
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
@@ -24,6 +23,8 @@
 	"os"
 	"path/filepath"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 var (
@@ -69,12 +70,12 @@
 	} else {
 		dir, err := filepath.Abs(filepath.Dir(*outputFile))
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 		fi, err := os.Stat(dir)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
 			os.Exit(1)
 		}
 		if !fi.IsDir() {
@@ -102,7 +103,7 @@
 	if *outputFile != "-" {
 		err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 	}
diff --git a/tools/compliance/cmd/bom_test.go b/tools/compliance/cmd/bom/bom_test.go
similarity index 69%
rename from tools/compliance/cmd/bom_test.go
rename to tools/compliance/cmd/bom/bom_test.go
index b0d61e1..163ac2a 100644
--- a/tools/compliance/cmd/bom_test.go
+++ b/tools/compliance/cmd/bom/bom_test.go
@@ -17,11 +17,22 @@
 import (
 	"bufio"
 	"bytes"
+	"fmt"
 	"os"
 	"strings"
 	"testing"
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test(t *testing.T) {
 	tests := []struct {
 		condition   string
@@ -31,9 +42,9 @@
 		expectedOut []string
 	}{
 		{
-			condition: "firstparty",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
+			condition:   "firstparty",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
 			stripPrefix: "out/target/product/fictional",
 			expectedOut: []string{
 				"/system/apex/highest.apex",
@@ -44,9 +55,9 @@
 			},
 		},
 		{
-			condition: "firstparty",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
+			condition:   "firstparty",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
 			stripPrefix: "out/target/product/fictional/data/",
 			expectedOut: []string{
 				"container.zip",
@@ -57,23 +68,23 @@
 			},
 		},
 		{
-			condition: "firstparty",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
+			condition:   "firstparty",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
 			stripPrefix: "out/target/product/fictional/bin/",
 			expectedOut: []string{"application"},
 		},
 		{
-			condition: "firstparty",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
+			condition:   "firstparty",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"bin/bin1"},
 		},
 		{
-			condition: "firstparty",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
+			condition:   "firstparty",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"lib/libd.so"},
 		},
@@ -102,27 +113,27 @@
 			},
 		},
 		{
-			condition: "notice",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
+			condition:   "notice",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
 			expectedOut: []string{"out/target/product/fictional/bin/application"},
 		},
 		{
-			condition: "notice",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
+			condition:   "notice",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
 			expectedOut: []string{"out/target/product/fictional/system/bin/bin1"},
 		},
 		{
-			condition: "notice",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
+			condition:   "notice",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
 			expectedOut: []string{"out/target/product/fictional/system/lib/libd.so"},
 		},
 		{
-			condition: "reciprocal",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
+			condition:   "reciprocal",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/apex/",
 			expectedOut: []string{
 				"highest.apex",
@@ -133,9 +144,9 @@
 			},
 		},
 		{
-			condition: "reciprocal",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
+			condition:   "reciprocal",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
 			stripPrefix: "out/target/product/fictional/data/",
 			expectedOut: []string{
 				"container.zip",
@@ -146,30 +157,30 @@
 			},
 		},
 		{
-			condition: "reciprocal",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
+			condition:   "reciprocal",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
 			stripPrefix: "out/target/product/fictional/bin/",
 			expectedOut: []string{"application"},
 		},
 		{
-			condition: "reciprocal",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
+			condition:   "reciprocal",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"bin/bin1"},
 		},
 		{
-			condition: "reciprocal",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
+			condition:   "reciprocal",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"lib/libd.so"},
 		},
 		{
-			condition: "restricted",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
+			condition:   "restricted",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/apex/",
 			expectedOut: []string{
 				"highest.apex",
@@ -180,9 +191,9 @@
 			},
 		},
 		{
-			condition: "restricted",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
+			condition:   "restricted",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
 			stripPrefix: "out/target/product/fictional/data/",
 			expectedOut: []string{
 				"container.zip",
@@ -193,30 +204,30 @@
 			},
 		},
 		{
-			condition: "restricted",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
+			condition:   "restricted",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
 			stripPrefix: "out/target/product/fictional/bin/",
 			expectedOut: []string{"application"},
 		},
 		{
-			condition: "restricted",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
+			condition:   "restricted",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"bin/bin1"},
 		},
 		{
-			condition: "restricted",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
+			condition:   "restricted",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"lib/libd.so"},
 		},
 		{
-			condition: "proprietary",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
+			condition:   "proprietary",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/apex/",
 			expectedOut: []string{
 				"highest.apex",
@@ -227,9 +238,9 @@
 			},
 		},
 		{
-			condition: "proprietary",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
+			condition:   "proprietary",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
 			stripPrefix: "out/target/product/fictional/data/",
 			expectedOut: []string{
 				"container.zip",
@@ -240,23 +251,23 @@
 			},
 		},
 		{
-			condition: "proprietary",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
+			condition:   "proprietary",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
 			stripPrefix: "out/target/product/fictional/bin/",
 			expectedOut: []string{"application"},
 		},
 		{
-			condition: "proprietary",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
+			condition:   "proprietary",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"bin/bin1"},
 		},
 		{
-			condition: "proprietary",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
+			condition:   "proprietary",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
 			stripPrefix: "out/target/product/fictional/system/",
 			expectedOut: []string{"lib/libd.so"},
 		},
@@ -275,7 +286,7 @@
 
 			err := billOfMaterials(&ctx, rootFiles...)
 			if err != nil {
-				t.Fatalf("bom: error = %w, stderr = %v", err, stderr)
+				t.Fatalf("bom: error = %v, stderr = %v", err, stderr)
 				return
 			}
 			if stderr.Len() > 0 {
diff --git a/tools/compliance/cmd/checkshare.go b/tools/compliance/cmd/checkshare/checkshare.go
similarity index 95%
rename from tools/compliance/cmd/checkshare.go
rename to tools/compliance/cmd/checkshare/checkshare.go
index 5114a28..752d14b 100644
--- a/tools/compliance/cmd/checkshare.go
+++ b/tools/compliance/cmd/checkshare/checkshare.go
@@ -15,13 +15,14 @@
 package main
 
 import (
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
 	"os"
 	"path/filepath"
 	"sort"
+
+	"android/soong/tools/compliance"
 )
 
 func init() {
@@ -46,12 +47,11 @@
 }
 
 var (
-	failConflicts = fmt.Errorf("conflicts")
+	failConflicts     = fmt.Errorf("conflicts")
 	failNoneRequested = fmt.Errorf("\nNo metadata files requested")
-	failNoLicenses = fmt.Errorf("No licenses")
+	failNoLicenses    = fmt.Errorf("No licenses")
 )
 
-
 // byError orders conflicts by error string
 type byError []compliance.SourceSharePrivacyConflict
 
diff --git a/tools/compliance/cmd/checkshare_test.go b/tools/compliance/cmd/checkshare/checkshare_test.go
similarity index 96%
rename from tools/compliance/cmd/checkshare_test.go
rename to tools/compliance/cmd/checkshare/checkshare_test.go
index 5036aa5..4589595 100644
--- a/tools/compliance/cmd/checkshare_test.go
+++ b/tools/compliance/cmd/checkshare/checkshare_test.go
@@ -17,10 +17,21 @@
 import (
 	"bytes"
 	"fmt"
+	"os"
 	"strings"
 	"testing"
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 type outcome struct {
 	target           string
 	privacyCondition string
diff --git a/tools/compliance/cmd/dumpgraph.go b/tools/compliance/cmd/dumpgraph/dumpgraph.go
similarity index 97%
rename from tools/compliance/cmd/dumpgraph.go
rename to tools/compliance/cmd/dumpgraph/dumpgraph.go
index 1ee63b2..02ab025 100644
--- a/tools/compliance/cmd/dumpgraph.go
+++ b/tools/compliance/cmd/dumpgraph/dumpgraph.go
@@ -15,7 +15,6 @@
 package main
 
 import (
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
@@ -23,6 +22,8 @@
 	"path/filepath"
 	"sort"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 var (
@@ -31,7 +32,7 @@
 	stripPrefix     = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
 
 	failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
-	failNoLicenses = fmt.Errorf("No licenses found")
+	failNoLicenses    = fmt.Errorf("No licenses found")
 )
 
 type context struct {
diff --git a/tools/compliance/cmd/dumpgraph_test.go b/tools/compliance/cmd/dumpgraph/dumpgraph_test.go
similarity index 99%
rename from tools/compliance/cmd/dumpgraph_test.go
rename to tools/compliance/cmd/dumpgraph/dumpgraph_test.go
index 3055022..516c1db 100644
--- a/tools/compliance/cmd/dumpgraph_test.go
+++ b/tools/compliance/cmd/dumpgraph/dumpgraph_test.go
@@ -17,10 +17,21 @@
 import (
 	"bytes"
 	"fmt"
+	"os"
 	"strings"
 	"testing"
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test_plaintext(t *testing.T) {
 	tests := []struct {
 		condition   string
@@ -1217,7 +1228,7 @@
 			outList := strings.Split(stdout.String(), "\n")
 			outLine := 0
 			if outList[outLine] != "strict digraph {" {
-				t.Errorf("dumpgraph: got 1st line %v, want strict digraph {")
+				t.Errorf("dumpgraph: got 1st line %v, want strict digraph {", outList[outLine])
 			}
 			outLine++
 			if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") {
diff --git a/tools/compliance/cmd/dumpresolutions.go b/tools/compliance/cmd/dumpresolutions/dumpresolutions.go
similarity index 98%
rename from tools/compliance/cmd/dumpresolutions.go
rename to tools/compliance/cmd/dumpresolutions/dumpresolutions.go
index 318cd91..463dfad 100644
--- a/tools/compliance/cmd/dumpresolutions.go
+++ b/tools/compliance/cmd/dumpresolutions/dumpresolutions.go
@@ -15,7 +15,6 @@
 package main
 
 import (
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
@@ -23,6 +22,8 @@
 	"path/filepath"
 	"sort"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 var (
@@ -32,7 +33,7 @@
 	stripPrefix     = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
 
 	failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
-	failNoLicenses = fmt.Errorf("No licenses found")
+	failNoLicenses    = fmt.Errorf("No licenses found")
 )
 
 type context struct {
diff --git a/tools/compliance/cmd/dumpresolutions_test.go b/tools/compliance/cmd/dumpresolutions/dumpresolutions_test.go
similarity index 98%
rename from tools/compliance/cmd/dumpresolutions_test.go
rename to tools/compliance/cmd/dumpresolutions/dumpresolutions_test.go
index d904671..b698bf2 100644
--- a/tools/compliance/cmd/dumpresolutions_test.go
+++ b/tools/compliance/cmd/dumpresolutions/dumpresolutions_test.go
@@ -16,12 +16,24 @@
 
 import (
 	"bytes"
-	"compliance"
 	"fmt"
+	"os"
 	"strings"
 	"testing"
+
+	"android/soong/tools/compliance"
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test_plaintext(t *testing.T) {
 	tests := []struct {
 		condition   string
@@ -97,7 +109,7 @@
 			name:      "apex_trimmed_share",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesShared.AsList(),
+				conditions:  compliance.ImpliesShared.AsList(),
 				stripPrefix: "testdata/firstparty/",
 			},
 			expectedOut: []string{},
@@ -107,7 +119,7 @@
 			name:      "apex_trimmed_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesPrivate.AsList(),
+				conditions:  compliance.ImpliesPrivate.AsList(),
 				stripPrefix: "testdata/firstparty/",
 			},
 			expectedOut: []string{},
@@ -117,7 +129,7 @@
 			name:      "apex_trimmed_share_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions:  append(compliance.ImpliesPrivate.AsList(),compliance.ImpliesShared.AsList()...),
+				conditions:  append(compliance.ImpliesPrivate.AsList(), compliance.ImpliesShared.AsList()...),
 				stripPrefix: "testdata/firstparty/",
 			},
 			expectedOut: []string{},
@@ -255,7 +267,7 @@
 			name:      "apex_trimmed_share",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesShared.AsList(),
+				conditions:  compliance.ImpliesShared.AsList(),
 				stripPrefix: "testdata/notice/",
 			},
 			expectedOut: []string{},
@@ -265,7 +277,7 @@
 			name:      "apex_trimmed_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesPrivate.AsList(),
+				conditions:  compliance.ImpliesPrivate.AsList(),
 				stripPrefix: "testdata/notice/",
 			},
 			expectedOut: []string{},
@@ -275,7 +287,7 @@
 			name:      "apex_trimmed_share_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions:  append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
+				conditions:  append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
 				stripPrefix: "testdata/notice/",
 			},
 			expectedOut: []string{},
@@ -408,7 +420,7 @@
 			name:      "apex_trimmed_share",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesShared.AsList(),
+				conditions:  compliance.ImpliesShared.AsList(),
 				stripPrefix: "testdata/reciprocal/",
 			},
 			expectedOut: []string{
@@ -424,7 +436,7 @@
 			name:      "apex_trimmed_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesPrivate.AsList(),
+				conditions:  compliance.ImpliesPrivate.AsList(),
 				stripPrefix: "testdata/reciprocal/",
 			},
 			expectedOut: []string{},
@@ -434,7 +446,7 @@
 			name:      "apex_trimmed_share_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
+				conditions:  append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
 				stripPrefix: "testdata/reciprocal/",
 			},
 			expectedOut: []string{
@@ -573,7 +585,7 @@
 			name:      "apex_trimmed_share",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesShared.AsList(),
+				conditions:  compliance.ImpliesShared.AsList(),
 				stripPrefix: "testdata/restricted/",
 			},
 			expectedOut: []string{
@@ -597,7 +609,7 @@
 			name:      "apex_trimmed_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesPrivate.AsList(),
+				conditions:  compliance.ImpliesPrivate.AsList(),
 				stripPrefix: "testdata/restricted/",
 			},
 			expectedOut: []string{},
@@ -607,7 +619,7 @@
 			name:      "apex_trimmed_share_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions:  append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
+				conditions:  append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
 				stripPrefix: "testdata/restricted/",
 			},
 			expectedOut: []string{
@@ -754,7 +766,7 @@
 			name:      "apex_trimmed_share",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesShared.AsList(),
+				conditions:  compliance.ImpliesShared.AsList(),
 				stripPrefix: "testdata/proprietary/",
 			},
 			expectedOut: []string{
@@ -771,7 +783,7 @@
 			name:      "apex_trimmed_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions: compliance.ImpliesPrivate.AsList(),
+				conditions:  compliance.ImpliesPrivate.AsList(),
 				stripPrefix: "testdata/proprietary/",
 			},
 			expectedOut: []string{
@@ -789,7 +801,7 @@
 			name:      "apex_trimmed_share_private",
 			roots:     []string{"highest.apex.meta_lic"},
 			ctx: context{
-				conditions:  append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
+				conditions:  append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
 				stripPrefix: "testdata/proprietary/",
 			},
 			expectedOut: []string{
@@ -930,7 +942,7 @@
 }
 
 // newTestCondition constructs a test license condition in the license graph.
-func newTestCondition(lg *compliance.LicenseGraph, conditionName... string) compliance.LicenseConditionSet {
+func newTestCondition(lg *compliance.LicenseGraph, conditionName ...string) compliance.LicenseConditionSet {
 	cs := compliance.NewLicenseConditionSet()
 	for _, name := range conditionName {
 		cs = cs.Plus(compliance.RecognizedConditionNames[name])
@@ -3305,7 +3317,7 @@
 			outList := strings.Split(stdout.String(), "\n")
 			outLine := 0
 			if outList[outLine] != "strict digraph {" {
-				t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {")
+				t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {", outList[outLine])
 			}
 			outLine++
 			if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") {
diff --git a/tools/compliance/cmd/htmlnotice.go b/tools/compliance/cmd/htmlnotice/htmlnotice.go
similarity index 95%
rename from tools/compliance/cmd/htmlnotice.go
rename to tools/compliance/cmd/htmlnotice/htmlnotice.go
index cff1ff8..2f59ee0 100644
--- a/tools/compliance/cmd/htmlnotice.go
+++ b/tools/compliance/cmd/htmlnotice/htmlnotice.go
@@ -16,7 +16,6 @@
 
 import (
 	"bytes"
-	"compliance"
 	"flag"
 	"fmt"
 	"html"
@@ -25,6 +24,8 @@
 	"os"
 	"path/filepath"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 var (
@@ -74,12 +75,12 @@
 	} else {
 		dir, err := filepath.Abs(filepath.Dir(*outputFile))
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 		fi, err := os.Stat(dir)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
 			os.Exit(1)
 		}
 		if !fi.IsDir() {
@@ -107,7 +108,7 @@
 	if *outputFile != "-" {
 		err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 	}
@@ -139,13 +140,13 @@
 	}
 
 	fmt.Fprintln(ctx.stdout, "<!DOCTYPE html>")
-	fmt.Fprintln(ctx.stdout, "<html><head>\n")
+	fmt.Fprintln(ctx.stdout, "<html><head>")
 	fmt.Fprintln(ctx.stdout, "<style type=\"text/css\">")
 	fmt.Fprintln(ctx.stdout, "body { padding: 2px; margin: 0; }")
 	fmt.Fprintln(ctx.stdout, "ul { list-style-type: none; margin: 0; padding: 0; }")
 	fmt.Fprintln(ctx.stdout, "li { padding-left: 1em; }")
 	fmt.Fprintln(ctx.stdout, ".file-list { margin-left: 1em; }")
-	fmt.Fprintln(ctx.stdout, "</style>\n")
+	fmt.Fprintln(ctx.stdout, "</style>")
 	if 0 < len(ctx.title) {
 		fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.title))
 	}
diff --git a/tools/compliance/cmd/htmlnotice_test.go b/tools/compliance/cmd/htmlnotice/htmlnotice_test.go
similarity index 97%
rename from tools/compliance/cmd/htmlnotice_test.go
rename to tools/compliance/cmd/htmlnotice/htmlnotice_test.go
index 8d3ea02..fc935c1 100644
--- a/tools/compliance/cmd/htmlnotice_test.go
+++ b/tools/compliance/cmd/htmlnotice/htmlnotice_test.go
@@ -39,6 +39,16 @@
 	libReference   = regexp.MustCompile(`^\s*<li><a href="#[^"]{32}">(.*)</a>\s*$`)
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test(t *testing.T) {
 	tests := []struct {
 		condition   string
@@ -560,7 +570,7 @@
 
 			err := htmlNotice(&ctx, rootFiles...)
 			if err != nil {
-				t.Fatalf("htmlnotice: error = %w, stderr = %v", err, stderr)
+				t.Fatalf("htmlnotice: error = %v, stderr = %v", err, stderr)
 				return
 			}
 			if stderr.Len() > 0 {
diff --git a/tools/compliance/cmd/listshare.go b/tools/compliance/cmd/listshare/listshare.go
similarity index 96%
rename from tools/compliance/cmd/listshare.go
rename to tools/compliance/cmd/listshare/listshare.go
index 5c58dc4..030caa7 100644
--- a/tools/compliance/cmd/listshare.go
+++ b/tools/compliance/cmd/listshare/listshare.go
@@ -15,7 +15,6 @@
 package main
 
 import (
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
@@ -23,6 +22,8 @@
 	"path/filepath"
 	"sort"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 func init() {
@@ -41,7 +42,7 @@
 
 var (
 	failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
-	failNoLicenses = fmt.Errorf("No licenses found")
+	failNoLicenses    = fmt.Errorf("No licenses found")
 )
 
 func main() {
diff --git a/tools/compliance/cmd/listshare_test.go b/tools/compliance/cmd/listshare/listshare_test.go
similarity index 97%
rename from tools/compliance/cmd/listshare_test.go
rename to tools/compliance/cmd/listshare/listshare_test.go
index 71a0be6..91e9a43 100644
--- a/tools/compliance/cmd/listshare_test.go
+++ b/tools/compliance/cmd/listshare/listshare_test.go
@@ -16,10 +16,22 @@
 
 import (
 	"bytes"
+	"fmt"
+	"os"
 	"strings"
 	"testing"
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test(t *testing.T) {
 	type projectShare struct {
 		project    string
diff --git a/tools/compliance/cmd/shippedlibs.go b/tools/compliance/cmd/shippedlibs/shippedlibs.go
similarity index 88%
rename from tools/compliance/cmd/shippedlibs.go
rename to tools/compliance/cmd/shippedlibs/shippedlibs.go
index f25d729..fddc489 100644
--- a/tools/compliance/cmd/shippedlibs.go
+++ b/tools/compliance/cmd/shippedlibs/shippedlibs.go
@@ -16,26 +16,27 @@
 
 import (
 	"bytes"
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
 	"io/fs"
 	"os"
 	"path/filepath"
+
+	"android/soong/tools/compliance"
 )
 
 var (
-	outputFile  = flag.String("o", "-", "Where to write the library list. (default stdout)")
+	outputFile = flag.String("o", "-", "Where to write the library list. (default stdout)")
 
 	failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
 	failNoLicenses    = fmt.Errorf("No licenses found")
 )
 
 type context struct {
-	stdout      io.Writer
-	stderr      io.Writer
-	rootFS      fs.FS
+	stdout io.Writer
+	stderr io.Writer
+	rootFS fs.FS
 }
 
 func init() {
@@ -66,12 +67,12 @@
 	} else {
 		dir, err := filepath.Abs(filepath.Dir(*outputFile))
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 		fi, err := os.Stat(dir)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
 			os.Exit(1)
 		}
 		if !fi.IsDir() {
@@ -99,7 +100,7 @@
 	if *outputFile != "-" {
 		err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 	}
diff --git a/tools/compliance/cmd/shippedlibs/shippedlibs_test.go b/tools/compliance/cmd/shippedlibs/shippedlibs_test.go
new file mode 100644
index 0000000..b6aad6d
--- /dev/null
+++ b/tools/compliance/cmd/shippedlibs/shippedlibs_test.go
@@ -0,0 +1,238 @@
+// Copyright 2021 Google LLC
+//
+// Licensed 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 main
+
+import (
+	"bufio"
+	"bytes"
+	"fmt"
+	"os"
+	"strings"
+	"testing"
+)
+
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
+func Test(t *testing.T) {
+	tests := []struct {
+		condition   string
+		name        string
+		roots       []string
+		expectedOut []string
+	}{
+		{
+			condition:   "firstparty",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
+			expectedOut: []string{"Android"},
+		},
+		{
+			condition:   "firstparty",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
+			expectedOut: []string{"Android"},
+		},
+		{
+			condition:   "firstparty",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
+			expectedOut: []string{"Android"},
+		},
+		{
+			condition:   "firstparty",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
+			expectedOut: []string{"Android"},
+		},
+		{
+			condition:   "firstparty",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
+			expectedOut: []string{"Android"},
+		},
+		{
+			condition:   "notice",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "notice",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "notice",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
+			expectedOut: []string{"Android", "Device"},
+		},
+		{
+			condition:   "notice",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "notice",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
+			expectedOut: []string{"External"},
+		},
+		{
+			condition:   "reciprocal",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "reciprocal",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "reciprocal",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
+			expectedOut: []string{"Android", "Device"},
+		},
+		{
+			condition:   "reciprocal",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "reciprocal",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
+			expectedOut: []string{"External"},
+		},
+		{
+			condition:   "restricted",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "restricted",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "restricted",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
+			expectedOut: []string{"Android", "Device"},
+		},
+		{
+			condition:   "restricted",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "restricted",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
+			expectedOut: []string{"External"},
+		},
+		{
+			condition:   "proprietary",
+			name:        "apex",
+			roots:       []string{"highest.apex.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "proprietary",
+			name:        "container",
+			roots:       []string{"container.zip.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "proprietary",
+			name:        "application",
+			roots:       []string{"application.meta_lic"},
+			expectedOut: []string{"Android", "Device"},
+		},
+		{
+			condition:   "proprietary",
+			name:        "binary",
+			roots:       []string{"bin/bin1.meta_lic"},
+			expectedOut: []string{"Android", "Device", "External"},
+		},
+		{
+			condition:   "proprietary",
+			name:        "library",
+			roots:       []string{"lib/libd.so.meta_lic"},
+			expectedOut: []string{"External"},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.condition+" "+tt.name, func(t *testing.T) {
+			stdout := &bytes.Buffer{}
+			stderr := &bytes.Buffer{}
+
+			rootFiles := make([]string, 0, len(tt.roots))
+			for _, r := range tt.roots {
+				rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r)
+			}
+
+			ctx := context{stdout, stderr, os.DirFS(".")}
+
+			err := shippedLibs(&ctx, rootFiles...)
+			if err != nil {
+				t.Fatalf("shippedLibs: error = %v, stderr = %v", err, stderr)
+				return
+			}
+			if stderr.Len() > 0 {
+				t.Errorf("shippedLibs: gotStderr = %v, want none", stderr)
+			}
+
+			t.Logf("got stdout: %s", stdout.String())
+
+			t.Logf("want stdout: %s", strings.Join(tt.expectedOut, "\n"))
+
+			out := bufio.NewScanner(stdout)
+			lineno := 0
+			for out.Scan() {
+				line := out.Text()
+				if strings.TrimLeft(line, " ") == "" {
+					continue
+				}
+				if len(tt.expectedOut) <= lineno {
+					t.Errorf("shippedLibs: unexpected output at line %d: got %q, want nothing (wanted %d lines)", lineno+1, line, len(tt.expectedOut))
+				} else if tt.expectedOut[lineno] != line {
+					t.Errorf("shippedLibs: unexpected output at line %d: got %q, want %q", lineno+1, line, tt.expectedOut[lineno])
+				}
+				lineno++
+			}
+			for ; lineno < len(tt.expectedOut); lineno++ {
+				t.Errorf("shippedLibs: missing output line %d: ended early, want %q", lineno+1, tt.expectedOut[lineno])
+			}
+		})
+	}
+}
diff --git a/tools/compliance/cmd/shippedlibs_test.go b/tools/compliance/cmd/shippedlibs_test.go
deleted file mode 100644
index 69ec817..0000000
--- a/tools/compliance/cmd/shippedlibs_test.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed 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 main
-
-import (
-	"bufio"
-	"bytes"
-	"os"
-	"strings"
-	"testing"
-)
-
-func Test(t *testing.T) {
-	tests := []struct {
-		condition   string
-		name        string
-		roots       []string
-		expectedOut []string
-	}{
-		{
-			condition: "firstparty",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
-			expectedOut: []string{"Android"},
-		},
-		{
-			condition: "firstparty",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
-			expectedOut: []string{"Android"},
-		},
-		{
-			condition: "firstparty",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
-			expectedOut: []string{"Android"},
-		},
-		{
-			condition: "firstparty",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
-			expectedOut: []string{"Android"},
-		},
-		{
-			condition: "firstparty",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
-			expectedOut: []string{"Android"},
-		},
-		{
-			condition: "notice",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "notice",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "notice",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
-			expectedOut: []string{"Android", "Device"},
-		},
-		{
-			condition: "notice",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "notice",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
-			expectedOut: []string{"External"},
-		},
-		{
-			condition: "reciprocal",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "reciprocal",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "reciprocal",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
-			expectedOut: []string{"Android", "Device"},
-		},
-		{
-			condition: "reciprocal",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "reciprocal",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
-			expectedOut: []string{"External"},
-		},
-		{
-			condition: "restricted",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "restricted",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "restricted",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
-			expectedOut: []string{"Android", "Device"},
-		},
-		{
-			condition: "restricted",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "restricted",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
-			expectedOut: []string{"External"},
-		},
-		{
-			condition: "proprietary",
-			name:      "apex",
-			roots:     []string{"highest.apex.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "proprietary",
-			name:      "container",
-			roots:     []string{"container.zip.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "proprietary",
-			name:      "application",
-			roots:     []string{"application.meta_lic"},
-			expectedOut: []string{"Android", "Device"},
-		},
-		{
-			condition: "proprietary",
-			name:      "binary",
-			roots:     []string{"bin/bin1.meta_lic"},
-			expectedOut: []string{"Android", "Device", "External"},
-		},
-		{
-			condition: "proprietary",
-			name:      "library",
-			roots:     []string{"lib/libd.so.meta_lic"},
-			expectedOut: []string{"External"},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.condition+" "+tt.name, func(t *testing.T) {
-			stdout := &bytes.Buffer{}
-			stderr := &bytes.Buffer{}
-
-			rootFiles := make([]string, 0, len(tt.roots))
-			for _, r := range tt.roots {
-				rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r)
-			}
-
-			ctx := context{stdout, stderr, os.DirFS(".")}
-
-			err := shippedLibs(&ctx, rootFiles...)
-			if err != nil {
-				t.Fatalf("shippedLibs: error = %w, stderr = %v", err, stderr)
-				return
-			}
-			if stderr.Len() > 0 {
-				t.Errorf("shippedLibs: gotStderr = %v, want none", stderr)
-			}
-
-			t.Logf("got stdout: %s", stdout.String())
-
-			t.Logf("want stdout: %s", strings.Join(tt.expectedOut, "\n"))
-
-			out := bufio.NewScanner(stdout)
-			lineno := 0
-			for out.Scan() {
-				line := out.Text()
-				if strings.TrimLeft(line, " ") == "" {
-					continue
-				}
-				if len(tt.expectedOut) <= lineno {
-					t.Errorf("shippedLibs: unexpected output at line %d: got %q, want nothing (wanted %d lines)", lineno+1, line, len(tt.expectedOut))
-				} else if tt.expectedOut[lineno] != line {
-					t.Errorf("shippedLibs: unexpected output at line %d: got %q, want %q", lineno+1, line, tt.expectedOut[lineno])
-				}
-				lineno++
-			}
-			for ; lineno < len(tt.expectedOut); lineno++ {
-				t.Errorf("shippedLibs: missing output line %d: ended early, want %q", lineno+1, tt.expectedOut[lineno])
-			}
-		})
-	}
-}
diff --git a/tools/compliance/cmd/textnotice.go b/tools/compliance/cmd/textnotice/textnotice.go
similarity index 94%
rename from tools/compliance/cmd/textnotice.go
rename to tools/compliance/cmd/textnotice/textnotice.go
index 91c57b0..b89aff1 100644
--- a/tools/compliance/cmd/textnotice.go
+++ b/tools/compliance/cmd/textnotice/textnotice.go
@@ -16,7 +16,6 @@
 
 import (
 	"bytes"
-	"compliance"
 	"flag"
 	"fmt"
 	"io"
@@ -24,6 +23,8 @@
 	"os"
 	"path/filepath"
 	"strings"
+
+	"android/soong/tools/compliance"
 )
 
 var (
@@ -69,12 +70,12 @@
 	} else {
 		dir, err := filepath.Abs(filepath.Dir(*outputFile))
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 		fi, err := os.Stat(dir)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
+			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
 			os.Exit(1)
 		}
 		if !fi.IsDir() {
@@ -102,7 +103,7 @@
 	if *outputFile != "-" {
 		err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
 		if err != nil {
-			fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
+			fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
 			os.Exit(1)
 		}
 	}
diff --git a/tools/compliance/cmd/textnotice_test.go b/tools/compliance/cmd/textnotice/textnotice_test.go
similarity index 97%
rename from tools/compliance/cmd/textnotice_test.go
rename to tools/compliance/cmd/textnotice/textnotice_test.go
index 156fb90..7993532 100644
--- a/tools/compliance/cmd/textnotice_test.go
+++ b/tools/compliance/cmd/textnotice/textnotice_test.go
@@ -28,6 +28,16 @@
 	horizontalRule = regexp.MustCompile("^===[=]*===$")
 )
 
+func TestMain(m *testing.M) {
+	// Change into the parent directory before running the tests
+	// so they can find the testdata directory.
+	if err := os.Chdir(".."); err != nil {
+		fmt.Printf("failed to change to testdata directory: %s\n", err)
+		os.Exit(1)
+	}
+	os.Exit(m.Run())
+}
+
 func Test(t *testing.T) {
 	tests := []struct {
 		condition   string
@@ -474,7 +484,7 @@
 
 			err := textNotice(&ctx, rootFiles...)
 			if err != nil {
-				t.Fatalf("textnotice: error = %w, stderr = %v", err, stderr)
+				t.Fatalf("textnotice: error = %v, stderr = %v", err, stderr)
 				return
 			}
 			if stderr.Len() > 0 {
diff --git a/tools/compliance/condition.go b/tools/compliance/condition.go
index 26b91ca..cfe6f82 100644
--- a/tools/compliance/condition.go
+++ b/tools/compliance/condition.go
@@ -61,16 +61,16 @@
 var (
 	// RecognizedConditionNames maps condition strings to LicenseCondition.
 	RecognizedConditionNames = map[string]LicenseCondition{
-		"unencumbered": UnencumberedCondition,
-		"permissive": PermissiveCondition,
-		"notice": NoticeCondition,
-		"reciprocal": ReciprocalCondition,
-		"restricted": RestrictedCondition,
+		"unencumbered":                        UnencumberedCondition,
+		"permissive":                          PermissiveCondition,
+		"notice":                              NoticeCondition,
+		"reciprocal":                          ReciprocalCondition,
+		"restricted":                          RestrictedCondition,
 		"restricted_with_classpath_exception": RestrictedClasspathExceptionCondition,
-		"restricted_allows_dynamic_linking": WeaklyRestrictedCondition,
-		"proprietary": ProprietaryCondition,
-		"by_exception_only": ByExceptionOnlyCondition,
-		"not_allowed": NotAllowedCondition,
+		"restricted_allows_dynamic_linking":   WeaklyRestrictedCondition,
+		"proprietary":                         ProprietaryCondition,
+		"by_exception_only":                   ByExceptionOnlyCondition,
+		"not_allowed":                         NotAllowedCondition,
 	}
 )
 
diff --git a/tools/compliance/conditionset_test.go b/tools/compliance/conditionset_test.go
index c7306e7..c91912f 100644
--- a/tools/compliance/conditionset_test.go
+++ b/tools/compliance/conditionset_test.go
@@ -33,82 +33,82 @@
 			conditions: []string{},
 			plus:       &[]string{},
 			matchingAny: map[string][]string{
-				"notice":     []string{},
-				"restricted": []string{},
+				"notice":                []string{},
+				"restricted":            []string{},
 				"restricted|reciprocal": []string{},
 			},
-			expected:   []string{},
+			expected: []string{},
 		},
 		{
 			name:       "emptyminusnothing",
 			conditions: []string{},
 			minus:      &[]string{},
 			matchingAny: map[string][]string{
-				"notice":     []string{},
-				"restricted": []string{},
+				"notice":                []string{},
+				"restricted":            []string{},
 				"restricted|reciprocal": []string{},
 			},
-			expected:   []string{},
+			expected: []string{},
 		},
 		{
 			name:       "emptyminusnotice",
 			conditions: []string{},
 			minus:      &[]string{"notice"},
 			matchingAny: map[string][]string{
-				"notice":     []string{},
-				"restricted": []string{},
+				"notice":                []string{},
+				"restricted":            []string{},
 				"restricted|reciprocal": []string{},
 			},
-			expected:   []string{},
+			expected: []string{},
 		},
 		{
-			name: "noticeonly",
+			name:       "noticeonly",
 			conditions: []string{"notice"},
 			matchingAny: map[string][]string{
-				"notice":     []string{"notice"},
-				"notice|proprietary":     []string{"notice"},
-				"restricted": []string{},
+				"notice":             []string{"notice"},
+				"notice|proprietary": []string{"notice"},
+				"restricted":         []string{},
 			},
 			expected: []string{"notice"},
 		},
 		{
-			name: "allnoticeonly",
+			name:       "allnoticeonly",
 			conditions: []string{"notice"},
-			plus: &[]string{"notice"},
+			plus:       &[]string{"notice"},
 			matchingAny: map[string][]string{
-				"notice":     []string{"notice"},
-				"notice|proprietary":     []string{"notice"},
-				"restricted": []string{},
+				"notice":             []string{"notice"},
+				"notice|proprietary": []string{"notice"},
+				"restricted":         []string{},
 			},
 			expected: []string{"notice"},
 		},
 		{
-			name: "emptyplusnotice",
+			name:       "emptyplusnotice",
 			conditions: []string{},
-			plus: &[]string{"notice"},
+			plus:       &[]string{"notice"},
 			matchingAny: map[string][]string{
-				"notice":     []string{"notice"},
-				"notice|proprietary":     []string{"notice"},
-				"restricted": []string{},
+				"notice":             []string{"notice"},
+				"notice|proprietary": []string{"notice"},
+				"restricted":         []string{},
 			},
 			expected: []string{"notice"},
 		},
 		{
-			name: "everything",
+			name:       "everything",
 			conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
-			plus: &[]string{"restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
+			plus:       &[]string{"restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
 			matchingAny: map[string][]string{
-				"unencumbered": []string{"unencumbered"},
-				"permissive":       []string{"permissive"},
-				"notice":     []string{"notice"},
-				"reciprocal":     []string{"reciprocal"},
-				"restricted":     []string{"restricted"},
-				"restricted_with_classpath_exception":     []string{"restricted_with_classpath_exception"},
-				"restricted_allows_dynamic_linking":     []string{"restricted_allows_dynamic_linking"},
-				"proprietary":     []string{"proprietary"},
-				"by_exception_only":     []string{"by_exception_only"},
-				"not_allowed":     []string{"not_allowed"},
-				"notice|proprietary":     []string{"notice", "proprietary"},
+				"unencumbered":                        []string{"unencumbered"},
+				"permissive":                          []string{"permissive"},
+				"notice":                              []string{"notice"},
+				"reciprocal":                          []string{"reciprocal"},
+				"restricted":                          []string{"restricted"},
+				"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
+				"restricted_allows_dynamic_linking":   []string{"restricted_allows_dynamic_linking"},
+				"proprietary":                         []string{"proprietary"},
+				"by_exception_only":                   []string{"by_exception_only"},
+				"not_allowed":                         []string{"not_allowed"},
+				"notice|proprietary":                  []string{"notice", "proprietary"},
 			},
 			expected: []string{
 				"unencumbered",
@@ -137,13 +137,13 @@
 				"by_exception_only",
 				"not_allowed",
 			},
-			plus: &[]string{},
+			plus:  &[]string{},
 			minus: &[]string{},
 			matchingAny: map[string][]string{
 				"unencumbered|permissive|notice": []string{"unencumbered", "permissive", "notice"},
-				"restricted|reciprocal":     []string{"reciprocal", "restricted"},
-				"proprietary|by_exception_only":     []string{"proprietary", "by_exception_only"},
-				"not_allowed":     []string{"not_allowed"},
+				"restricted|reciprocal":          []string{"reciprocal", "restricted"},
+				"proprietary|by_exception_only":  []string{"proprietary", "by_exception_only"},
+				"not_allowed":                    []string{"not_allowed"},
 			},
 			expected: []string{
 				"unencumbered",
@@ -159,21 +159,21 @@
 			},
 		},
 		{
-			name: "allbutone",
+			name:       "allbutone",
 			conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
-			plus: &[]string{"restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
+			plus:       &[]string{"restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
 			matchingAny: map[string][]string{
-				"unencumbered": []string{"unencumbered"},
-				"permissive":       []string{"permissive"},
-				"notice":     []string{"notice"},
-				"reciprocal":     []string{"reciprocal"},
-				"restricted":     []string{"restricted"},
-				"restricted_with_classpath_exception":     []string{},
-				"restricted_allows_dynamic_linking":     []string{"restricted_allows_dynamic_linking"},
-				"proprietary":     []string{"proprietary"},
-				"by_exception_only":     []string{"by_exception_only"},
-				"not_allowed":     []string{"not_allowed"},
-				"notice|proprietary":     []string{"notice", "proprietary"},
+				"unencumbered":                        []string{"unencumbered"},
+				"permissive":                          []string{"permissive"},
+				"notice":                              []string{"notice"},
+				"reciprocal":                          []string{"reciprocal"},
+				"restricted":                          []string{"restricted"},
+				"restricted_with_classpath_exception": []string{},
+				"restricted_allows_dynamic_linking":   []string{"restricted_allows_dynamic_linking"},
+				"proprietary":                         []string{"proprietary"},
+				"by_exception_only":                   []string{"by_exception_only"},
+				"not_allowed":                         []string{"not_allowed"},
+				"notice|proprietary":                  []string{"notice", "proprietary"},
 			},
 			expected: []string{
 				"unencumbered",
@@ -203,17 +203,17 @@
 			},
 			minus: &[]string{"restricted_allows_dynamic_linking"},
 			matchingAny: map[string][]string{
-				"unencumbered": []string{"unencumbered"},
-				"permissive":       []string{"permissive"},
-				"notice":     []string{"notice"},
-				"reciprocal":     []string{"reciprocal"},
-				"restricted":     []string{"restricted"},
-				"restricted_with_classpath_exception":     []string{"restricted_with_classpath_exception"},
-				"restricted_allows_dynamic_linking":     []string{},
-				"proprietary":     []string{"proprietary"},
-				"by_exception_only":     []string{"by_exception_only"},
-				"not_allowed":     []string{"not_allowed"},
-				"restricted|proprietary":     []string{"restricted", "proprietary"},
+				"unencumbered":                        []string{"unencumbered"},
+				"permissive":                          []string{"permissive"},
+				"notice":                              []string{"notice"},
+				"reciprocal":                          []string{"reciprocal"},
+				"restricted":                          []string{"restricted"},
+				"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
+				"restricted_allows_dynamic_linking":   []string{},
+				"proprietary":                         []string{"proprietary"},
+				"by_exception_only":                   []string{"by_exception_only"},
+				"not_allowed":                         []string{"not_allowed"},
+				"restricted|proprietary":              []string{"restricted", "proprietary"},
 			},
 			expected: []string{
 				"unencumbered",
@@ -254,35 +254,35 @@
 				"not_allowed",
 			},
 			matchingAny: map[string][]string{
-				"unencumbered": []string{},
-				"permissive":       []string{},
-				"notice":     []string{},
-				"reciprocal":     []string{},
-				"restricted":     []string{},
-				"restricted_with_classpath_exception":     []string{},
-				"restricted_allows_dynamic_linking":     []string{},
-				"proprietary":     []string{},
-				"by_exception_only":     []string{},
-				"not_allowed":     []string{},
-				"restricted|proprietary":     []string{},
+				"unencumbered":                        []string{},
+				"permissive":                          []string{},
+				"notice":                              []string{},
+				"reciprocal":                          []string{},
+				"restricted":                          []string{},
+				"restricted_with_classpath_exception": []string{},
+				"restricted_allows_dynamic_linking":   []string{},
+				"proprietary":                         []string{},
+				"by_exception_only":                   []string{},
+				"not_allowed":                         []string{},
+				"restricted|proprietary":              []string{},
 			},
 			expected: []string{},
 		},
 		{
-			name: "restrictedplus",
+			name:       "restrictedplus",
 			conditions: []string{"restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking"},
-			plus: &[]string{"permissive", "notice", "restricted", "proprietary"},
+			plus:       &[]string{"permissive", "notice", "restricted", "proprietary"},
 			matchingAny: map[string][]string{
-				"unencumbered":     []string{},
-				"permissive":     []string{"permissive"},
-				"notice":     []string{"notice"},
-				"restricted":     []string{"restricted"},
-				"restricted_with_classpath_exception":     []string{"restricted_with_classpath_exception"},
-				"restricted_allows_dynamic_linking":     []string{"restricted_allows_dynamic_linking"},
-				"proprietary":     []string{"proprietary"},
-				"restricted|proprietary":     []string{"restricted", "proprietary"},
-				"by_exception_only": []string{},
-				"proprietary|by_exception_only":     []string{"proprietary"},
+				"unencumbered":                        []string{},
+				"permissive":                          []string{"permissive"},
+				"notice":                              []string{"notice"},
+				"restricted":                          []string{"restricted"},
+				"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
+				"restricted_allows_dynamic_linking":   []string{"restricted_allows_dynamic_linking"},
+				"proprietary":                         []string{"proprietary"},
+				"restricted|proprietary":              []string{"restricted", "proprietary"},
+				"by_exception_only":                   []string{},
+				"proprietary|by_exception_only":       []string{"proprietary"},
 			},
 			expected: []string{"permissive", "notice", "restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary"},
 		},
@@ -363,7 +363,7 @@
 				}
 				actualConditions := actual.AsList()
 				if len(actualConditions) != len(expectedConditions) {
-					t.Errorf("len(MatchingAny(%d).AsList()):  got %d, want %d",
+					t.Errorf("len(MatchingAny(%s).AsList()):  got %d, want %d",
 						data, len(actualNames), len(expectedNames))
 				} else {
 					for i := 0; i < len(actualNames); i++ {
@@ -452,7 +452,7 @@
 				for i := 0; i < len(actualConditions); i++ {
 					if actualConditions[i] != expectedConditions[i] {
 						t.Errorf("actual.AsList()[%d]: got %s, want %s",
-							i, actualConditions[i], expectedConditions[i])
+							i, actualConditions[i].Name(), expectedConditions[i].Name())
 						break
 					}
 				}
@@ -552,7 +552,7 @@
 				for i := 0; i < len(actualConditions); i++ {
 					if actualConditions[i] != expectedConditions[i] {
 						t.Errorf("actual.AsList()[%d}: got %s, want %s",
-							i, actualConditions[i], expectedConditions[i])
+							i, actualConditions[i].Name(), expectedConditions[i].Name())
 						break
 					}
 				}
@@ -629,7 +629,7 @@
 			if checkExpected(cs, t) {
 				checkMatching(cs, t)
 			}
-			if checkExpectedSet(cs, t){
+			if checkExpectedSet(cs, t) {
 				checkMatchingSet(cs, t)
 			}
 		})
@@ -639,7 +639,7 @@
 			if checkExpected(cs, t) {
 				checkMatching(cs, t)
 			}
-			if checkExpectedSet(cs, t){
+			if checkExpectedSet(cs, t) {
 				checkMatchingSet(cs, t)
 			}
 		})
@@ -649,7 +649,7 @@
 			if checkExpected(cs, t) {
 				checkMatching(cs, t)
 			}
-			if checkExpectedSet(cs, t){
+			if checkExpectedSet(cs, t) {
 				checkMatchingSet(cs, t)
 			}
 		})
diff --git a/tools/compliance/go.mod b/tools/compliance/go.mod
new file mode 100644
index 0000000..61e2158
--- /dev/null
+++ b/tools/compliance/go.mod
@@ -0,0 +1,18 @@
+module android/soong/tools/compliance
+
+require google.golang.org/protobuf v0.0.0
+
+replace google.golang.org/protobuf v0.0.0 => ../../../../external/golang-protobuf
+
+require android/soong v0.0.0
+
+replace android/soong v0.0.0 => ../../../soong									      
+// Indirect deps from golang-protobuf
+exclude github.com/golang/protobuf v1.5.0
+
+replace github.com/google/go-cmp v0.5.5 => ../../../../external/go-cmp
+
+// Indirect dep from go-cmp
+exclude golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
+
+go 1.18
diff --git a/tools/compliance/graph.go b/tools/compliance/graph.go
index efcc6e4..e73ab46 100644
--- a/tools/compliance/graph.go
+++ b/tools/compliance/graph.go
@@ -148,7 +148,7 @@
 type TargetEdgeList []*TargetEdge
 
 // Len returns the count of the elmements in the list.
-func (l TargetEdgeList) Len() int      { return len(l) }
+func (l TargetEdgeList) Len() int { return len(l) }
 
 // Swap rearranges 2 elements so that each occupies the other's former position.
 func (l TargetEdgeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
@@ -171,7 +171,7 @@
 // edge with a context `ctx` defined by whatever process is creating the path.
 type TargetEdgePathSegment struct {
 	edge *TargetEdge
-	ctx interface{}
+	ctx  interface{}
 }
 
 // Target identifies the target that depends on the dependency.
@@ -495,7 +495,7 @@
 type TargetNodeList []*TargetNode
 
 // Len returns the count of elements in the list.
-func (l TargetNodeList) Len() int      { return len(l) }
+func (l TargetNodeList) Len() int { return len(l) }
 
 // Swap rearranges 2 elements so that each occupies the other's former position.
 func (l TargetNodeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
diff --git a/tools/compliance/policy/policy.go b/tools/compliance/policy_policy.go
similarity index 93%
rename from tools/compliance/policy/policy.go
rename to tools/compliance/policy_policy.go
index 4261ed0..442025e 100644
--- a/tools/compliance/policy/policy.go
+++ b/tools/compliance/policy_policy.go
@@ -33,21 +33,21 @@
 	// proprietary or confidential pathnames to whether to strip the prefix
 	// from the path when used as the library name for notices.
 	SafePathPrefixes = map[string]bool{
-		"external/": true,
-		"art/": false,
-		"build/": false,
-		"cts/": false,
-		"dalvik/": false,
-		"developers/": false,
+		"external/":    true,
+		"art/":         false,
+		"build/":       false,
+		"cts/":         false,
+		"dalvik/":      false,
+		"developers/":  false,
 		"development/": false,
-		"frameworks/": false,
-		"packages/": true,
-		"prebuilts/": false,
-		"sdk/": false,
-		"system/": false,
-		"test/": false,
-		"toolchain/": false,
-		"tools/": false,
+		"frameworks/":  false,
+		"packages/":    true,
+		"prebuilts/":   false,
+		"sdk/":         false,
+		"system/":      false,
+		"test/":        false,
+		"toolchain/":   false,
+		"tools/":       false,
 	}
 
 	// SafePrebuiltPrefixes maps the regular expression to match a prebuilt
@@ -62,8 +62,8 @@
 
 	// ImpliesNotice lists the condition names implying a notice or attribution policy.
 	ImpliesNotice = LicenseConditionSet(UnencumberedCondition | PermissiveCondition | NoticeCondition | ReciprocalCondition |
-			RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition |
-			ProprietaryCondition | ByExceptionOnlyCondition)
+		RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition |
+		ProprietaryCondition | ByExceptionOnlyCondition)
 
 	// ImpliesReciprocal lists the condition names implying a local source-sharing policy.
 	ImpliesReciprocal = LicenseConditionSet(ReciprocalCondition)
@@ -143,7 +143,6 @@
 	return cs
 }
 
-
 // Resolution happens in three phases:
 //
 // 1. A bottom-up traversal propagates (restricted) license conditions up to
@@ -182,7 +181,6 @@
 // Not all restricted licenses are create equal. Some have special rules or
 // exceptions. e.g. LGPL or "with classpath excption".
 
-
 // depConditionsPropagatingToTarget returns the conditions which propagate up an
 // edge from dependency to target.
 //
@@ -204,7 +202,7 @@
 	}
 
 	result |= depConditions & LicenseConditionSet(RestrictedCondition)
-	if 0 != (depConditions & LicenseConditionSet(RestrictedClasspathExceptionCondition)) && !edgeNodesAreIndependentModules(e) {
+	if 0 != (depConditions&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && !edgeNodesAreIndependentModules(e) {
 		result |= LicenseConditionSet(RestrictedClasspathExceptionCondition)
 	}
 	return result
@@ -264,13 +262,12 @@
 	}
 
 	result &= LicenseConditionSet(RestrictedCondition | RestrictedClasspathExceptionCondition)
-	if 0 != (result & LicenseConditionSet(RestrictedClasspathExceptionCondition)) && edgeNodesAreIndependentModules(e) {
+	if 0 != (result&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && edgeNodesAreIndependentModules(e) {
 		result &= LicenseConditionSet(RestrictedCondition)
 	}
 	return result
 }
 
-
 // edgeIsDynamicLink returns true for edges representing shared libraries
 // linked dynamically at runtime.
 func edgeIsDynamicLink(e *TargetEdge) bool {
diff --git a/tools/compliance/policy/policy_test.go b/tools/compliance/policy_policy_test.go
similarity index 99%
rename from tools/compliance/policy/policy_test.go
rename to tools/compliance/policy_policy_test.go
index 09e831c..32dd5fd 100644
--- a/tools/compliance/policy/policy_test.go
+++ b/tools/compliance/policy_policy_test.go
@@ -226,7 +226,7 @@
 			fs[tt.edge.dep] = []byte(meta[tt.edge.dep])
 			lg, err := ReadLicenseGraph(&fs, stderr, []string{tt.edge.target})
 			if err != nil {
-				t.Errorf("unexpected error reading graph: %w", err)
+				t.Errorf("unexpected error reading graph: %s", err)
 				return
 			}
 			edge := lg.Edges()[0]
diff --git a/tools/compliance/policy/resolve.go b/tools/compliance/policy_resolve.go
similarity index 100%
rename from tools/compliance/policy/resolve.go
rename to tools/compliance/policy_resolve.go
diff --git a/tools/compliance/policy/resolve_test.go b/tools/compliance/policy_resolve_test.go
similarity index 98%
rename from tools/compliance/policy/resolve_test.go
rename to tools/compliance/policy_resolve_test.go
index 09dd7dd..f98e4cc 100644
--- a/tools/compliance/policy/resolve_test.go
+++ b/tools/compliance/policy_resolve_test.go
@@ -332,7 +332,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 
@@ -643,7 +643,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 
diff --git a/tools/compliance/policy/resolvenotices.go b/tools/compliance/policy_resolvenotices.go
similarity index 100%
rename from tools/compliance/policy/resolvenotices.go
rename to tools/compliance/policy_resolvenotices.go
diff --git a/tools/compliance/policy/resolvenotices_test.go b/tools/compliance/policy_resolvenotices_test.go
similarity index 99%
rename from tools/compliance/policy/resolvenotices_test.go
rename to tools/compliance/policy_resolvenotices_test.go
index 275c0a5..cd9dd71 100644
--- a/tools/compliance/policy/resolvenotices_test.go
+++ b/tools/compliance/policy_resolvenotices_test.go
@@ -457,7 +457,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedRs := toResolutionSet(lg, tt.expectedResolutions)
diff --git a/tools/compliance/policy/resolveprivacy.go b/tools/compliance/policy_resolveprivacy.go
similarity index 100%
rename from tools/compliance/policy/resolveprivacy.go
rename to tools/compliance/policy_resolveprivacy.go
diff --git a/tools/compliance/policy/resolveprivacy_test.go b/tools/compliance/policy_resolveprivacy_test.go
similarity index 96%
rename from tools/compliance/policy/resolveprivacy_test.go
rename to tools/compliance/policy_resolveprivacy_test.go
index 2072d22..e8c953a 100644
--- a/tools/compliance/policy/resolveprivacy_test.go
+++ b/tools/compliance/policy_resolveprivacy_test.go
@@ -76,7 +76,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedRs := toResolutionSet(lg, tt.expectedResolutions)
diff --git a/tools/compliance/policy/resolveshare.go b/tools/compliance/policy_resolveshare.go
similarity index 100%
rename from tools/compliance/policy/resolveshare.go
rename to tools/compliance/policy_resolveshare.go
diff --git a/tools/compliance/policy/resolveshare_test.go b/tools/compliance/policy_resolveshare_test.go
similarity index 98%
rename from tools/compliance/policy/resolveshare_test.go
rename to tools/compliance/policy_resolveshare_test.go
index f73888d..c451b86 100644
--- a/tools/compliance/policy/resolveshare_test.go
+++ b/tools/compliance/policy_resolveshare_test.go
@@ -286,7 +286,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedRs := toResolutionSet(lg, tt.expectedResolutions)
diff --git a/tools/compliance/policy/shareprivacyconflicts.go b/tools/compliance/policy_shareprivacyconflicts.go
similarity index 100%
rename from tools/compliance/policy/shareprivacyconflicts.go
rename to tools/compliance/policy_shareprivacyconflicts.go
diff --git a/tools/compliance/policy/shareprivacyconflicts_test.go b/tools/compliance/policy_shareprivacyconflicts_test.go
similarity index 96%
rename from tools/compliance/policy/shareprivacyconflicts_test.go
rename to tools/compliance/policy_shareprivacyconflicts_test.go
index ad3f3f4..069daa2 100644
--- a/tools/compliance/policy/shareprivacyconflicts_test.go
+++ b/tools/compliance/policy_shareprivacyconflicts_test.go
@@ -24,7 +24,7 @@
 type byConflict []SourceSharePrivacyConflict
 
 // Len returns the count of elements in the slice.
-func (l byConflict) Len() int      { return len(l) }
+func (l byConflict) Len() int { return len(l) }
 
 // Swap rearranged 2 elements so that each occupies the other's former
 // position.
@@ -99,7 +99,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedConflicts := toConflictList(lg, tt.expectedConflicts)
diff --git a/tools/compliance/policy/shipped.go b/tools/compliance/policy_shipped.go
similarity index 100%
rename from tools/compliance/policy/shipped.go
rename to tools/compliance/policy_shipped.go
diff --git a/tools/compliance/policy/shipped_test.go b/tools/compliance/policy_shipped_test.go
similarity index 83%
rename from tools/compliance/policy/shipped_test.go
rename to tools/compliance/policy_shipped_test.go
index 718e56f..3ae9b46 100644
--- a/tools/compliance/policy/shipped_test.go
+++ b/tools/compliance/policy_shipped_test.go
@@ -29,30 +29,30 @@
 		expectedNodes []string
 	}{
 		{
-			name:      "singleton",
-			roots:     []string{"apacheLib.meta_lic"},
-			edges: []annotated{},
+			name:          "singleton",
+			roots:         []string{"apacheLib.meta_lic"},
+			edges:         []annotated{},
 			expectedNodes: []string{"apacheLib.meta_lic"},
 		},
 		{
-			name:      "simplebinary",
-			roots:     []string{"apacheBin.meta_lic"},
+			name:  "simplebinary",
+			roots: []string{"apacheBin.meta_lic"},
 			edges: []annotated{
 				{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
 			},
 			expectedNodes: []string{"apacheBin.meta_lic", "apacheLib.meta_lic"},
 		},
 		{
-			name:      "simpledynamic",
-			roots:     []string{"apacheBin.meta_lic"},
+			name:  "simpledynamic",
+			roots: []string{"apacheBin.meta_lic"},
 			edges: []annotated{
 				{"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"dynamic"}},
 			},
 			expectedNodes: []string{"apacheBin.meta_lic"},
 		},
 		{
-			name:      "container",
-			roots:     []string{"apacheContainer.meta_lic"},
+			name:  "container",
+			roots: []string{"apacheContainer.meta_lic"},
 			edges: []annotated{
 				{"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}},
 				{"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}},
@@ -64,8 +64,8 @@
 			},
 		},
 		{
-			name:      "binary",
-			roots:     []string{"apacheBin.meta_lic"},
+			name:  "binary",
+			roots: []string{"apacheBin.meta_lic"},
 			edges: []annotated{
 				{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
 				{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}},
@@ -77,8 +77,8 @@
 			},
 		},
 		{
-			name:      "binarydynamic",
-			roots:     []string{"apacheBin.meta_lic"},
+			name:  "binarydynamic",
+			roots: []string{"apacheBin.meta_lic"},
 			edges: []annotated{
 				{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
 				{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"dynamic"}},
@@ -89,8 +89,8 @@
 			},
 		},
 		{
-			name:      "containerdeep",
-			roots:     []string{"apacheContainer.meta_lic"},
+			name:  "containerdeep",
+			roots: []string{"apacheContainer.meta_lic"},
 			edges: []annotated{
 				{"apacheContainer.meta_lic", "apacheBin.meta_lic", []string{"static"}},
 				{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
@@ -108,7 +108,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			t.Logf("graph:")
@@ -127,7 +127,7 @@
 
 			t.Logf("sorted nodes: [%s]", strings.Join(actualNodes, ", "))
 			t.Logf("expected nodes: [%s]", strings.Join(expectedNodes, ", "))
-                        if len(expectedNodes) != len(actualNodes) {
+			if len(expectedNodes) != len(actualNodes) {
 				t.Errorf("unexpected number of shipped nodes: %d nodes, want %d nodes",
 					len(actualNodes), len(expectedNodes))
 				return
diff --git a/tools/compliance/policy/walk.go b/tools/compliance/policy_walk.go
similarity index 99%
rename from tools/compliance/policy/walk.go
rename to tools/compliance/policy_walk.go
index 3e73088..f4d7bba 100644
--- a/tools/compliance/policy/walk.go
+++ b/tools/compliance/policy_walk.go
@@ -83,7 +83,7 @@
 // specific set of conditions.
 type resolutionKey struct {
 	target *TargetNode
-	cs LicenseConditionSet
+	cs     LicenseConditionSet
 }
 
 // WalkResolutionsForCondition performs a top-down walk of the LicenseGraph
diff --git a/tools/compliance/policy/walk_test.go b/tools/compliance/policy_walk_test.go
similarity index 99%
rename from tools/compliance/policy/walk_test.go
rename to tools/compliance/policy_walk_test.go
index a2ec6e7..92867f9 100644
--- a/tools/compliance/policy/walk_test.go
+++ b/tools/compliance/policy_walk_test.go
@@ -620,7 +620,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedRs := toResolutionSet(lg, tt.expectedResolutions)
@@ -1228,7 +1228,7 @@
 			stderr := &bytes.Buffer{}
 			lg, err := toGraph(stderr, tt.roots, tt.edges)
 			if err != nil {
-				t.Errorf("unexpected test data error: got %w, want no error", err)
+				t.Errorf("unexpected test data error: got %s, want no error", err)
 				return
 			}
 			expectedAs := toActionSet(lg, tt.expectedActions)
diff --git a/tools/compliance/readgraph.go b/tools/compliance/readgraph.go
index c809a96..6f91e1c 100644
--- a/tools/compliance/readgraph.go
+++ b/tools/compliance/readgraph.go
@@ -185,7 +185,7 @@
 
 // addDependencies converts the proto AnnotatedDependencies into `edges`
 func addDependencies(lg *LicenseGraph, tn *TargetNode) error {
-	tn.edges = make(TargetEdgeList, 0,len(tn.proto.Deps))
+	tn.edges = make(TargetEdgeList, 0, len(tn.proto.Deps))
 	for _, ad := range tn.proto.Deps {
 		dependency := ad.GetFile()
 		if len(dependency) == 0 {
diff --git a/tools/compliance/readgraph_test.go b/tools/compliance/readgraph_test.go
index 6ff7a6c..db52fb1 100644
--- a/tools/compliance/readgraph_test.go
+++ b/tools/compliance/readgraph_test.go
@@ -88,9 +88,9 @@
 			lg, err := ReadLicenseGraph(tt.fs, stderr, tt.roots)
 			if err != nil {
 				if len(tt.expectedError) == 0 {
-					t.Errorf("unexpected error: got %w, want no error", err)
+					t.Errorf("unexpected error: got %s, want no error", err)
 				} else if !strings.Contains(err.Error(), tt.expectedError) {
-					t.Errorf("unexpected error: got %w, want %q", err, tt.expectedError)
+					t.Errorf("unexpected error: got %s, want %q", err, tt.expectedError)
 				}
 				return
 			}
diff --git a/tools/compliance/resolution.go b/tools/compliance/resolution.go
index 6f15ca3..acc61e2 100644
--- a/tools/compliance/resolution.go
+++ b/tools/compliance/resolution.go
@@ -66,7 +66,7 @@
 type ResolutionList []Resolution
 
 // Len returns the count of elements in the list.
-func (l ResolutionList) Len() int      { return len(l) }
+func (l ResolutionList) Len() int { return len(l) }
 
 // Swap rearranges 2 elements so that each occupies the other's former position.
 func (l ResolutionList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
diff --git a/tools/compliance/resolutionset.go b/tools/compliance/resolutionset.go
index 893ef26..ef89883 100644
--- a/tools/compliance/resolutionset.go
+++ b/tools/compliance/resolutionset.go
@@ -65,7 +65,6 @@
 	return result
 }
 
-
 // AttachesToTarget returns true if the set contains conditions that
 // are `attachedTo`.
 func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
@@ -73,7 +72,6 @@
 	return isPresent
 }
 
-
 // Resolutions returns the list of resolutions that `attachedTo`
 // target must resolve. Returns empty list if no conditions apply.
 func (rs ResolutionSet) Resolutions(attachesTo *TargetNode) ResolutionList {
diff --git a/tools/compliance/test_util.go b/tools/compliance/test_util.go
index 8f4088a..26d7461 100644
--- a/tools/compliance/test_util.go
+++ b/tools/compliance/test_util.go
@@ -33,56 +33,56 @@
 
 	// GPL starts a test metadata file for GPL 2.0 licensing.
 	GPL = `` +
-`package_name: "Free Software"
+		`package_name: "Free Software"
 license_kinds: "SPDX-license-identifier-GPL-2.0"
 license_conditions: "restricted"
 `
 
 	// Classpath starts a test metadata file for GPL 2.0 with classpath exception licensing.
 	Classpath = `` +
-`package_name: "Free Software"
+		`package_name: "Free Software"
 license_kinds: "SPDX-license-identifier-GPL-2.0-with-classpath-exception"
 license_conditions: "restricted"
 `
 
 	// DependentModule starts a test metadata file for a module in the same package as `Classpath`.
 	DependentModule = `` +
-`package_name: "Free Software"
+		`package_name: "Free Software"
 license_kinds: "SPDX-license-identifier-MIT"
 license_conditions: "notice"
 `
 
 	// LGPL starts a test metadata file for a module with LGPL 2.0 licensing.
 	LGPL = `` +
-`package_name: "Free Library"
+		`package_name: "Free Library"
 license_kinds: "SPDX-license-identifier-LGPL-2.0"
 license_conditions: "restricted"
 `
 
 	// MPL starts a test metadata file for a module with MPL 2.0 reciprical licensing.
 	MPL = `` +
-`package_name: "Reciprocal"
+		`package_name: "Reciprocal"
 license_kinds: "SPDX-license-identifier-MPL-2.0"
 license_conditions: "reciprocal"
 `
 
 	// MIT starts a test metadata file for a module with generic notice (MIT) licensing.
 	MIT = `` +
-`package_name: "Android"
+		`package_name: "Android"
 license_kinds: "SPDX-license-identifier-MIT"
 license_conditions: "notice"
 `
 
 	// Proprietary starts a test metadata file for a module with proprietary licensing.
 	Proprietary = `` +
-`package_name: "Android"
+		`package_name: "Android"
 license_kinds: "legacy_proprietary"
 license_conditions: "proprietary"
 `
 
 	// ByException starts a test metadata file for a module with by_exception_only licensing.
 	ByException = `` +
-`package_name: "Special"
+		`package_name: "Special"
 license_kinds: "legacy_by_exception_only"
 license_conditions: "by_exception_only"
 `
@@ -91,22 +91,22 @@
 var (
 	// meta maps test file names to metadata file content without dependencies.
 	meta = map[string]string{
-		"apacheBin.meta_lic": AOSP,
-		"apacheLib.meta_lic": AOSP,
-		"apacheContainer.meta_lic": AOSP + "is_container: true\n",
-		"dependentModule.meta_lic": DependentModule,
+		"apacheBin.meta_lic":                 AOSP,
+		"apacheLib.meta_lic":                 AOSP,
+		"apacheContainer.meta_lic":           AOSP + "is_container: true\n",
+		"dependentModule.meta_lic":           DependentModule,
 		"gplWithClasspathException.meta_lic": Classpath,
-		"gplBin.meta_lic": GPL,
-		"gplLib.meta_lic": GPL,
-		"gplContainer.meta_lic": GPL + "is_container: true\n",
-		"lgplBin.meta_lic": LGPL,
-		"lgplLib.meta_lic": LGPL,
-		"mitBin.meta_lic": MIT,
-		"mitLib.meta_lic": MIT,
-		"mplBin.meta_lic": MPL,
-		"mplLib.meta_lic": MPL,
-		"proprietary.meta_lic": Proprietary,
-		"by_exception.meta_lic": ByException,
+		"gplBin.meta_lic":                    GPL,
+		"gplLib.meta_lic":                    GPL,
+		"gplContainer.meta_lic":              GPL + "is_container: true\n",
+		"lgplBin.meta_lic":                   LGPL,
+		"lgplLib.meta_lic":                   LGPL,
+		"mitBin.meta_lic":                    MIT,
+		"mitLib.meta_lic":                    MIT,
+		"mplBin.meta_lic":                    MPL,
+		"mplLib.meta_lic":                    MPL,
+		"proprietary.meta_lic":               Proprietary,
+		"by_exception.meta_lic":              ByException,
 	}
 )
 
@@ -204,7 +204,7 @@
 type byEdge []edge
 
 // Len returns the count of elements in the slice.
-func (l byEdge) Len() int      { return len(l) }
+func (l byEdge) Len() int { return len(l) }
 
 // Swap rearranges 2 elements of the slice so that each occupies the other's
 // former position.
@@ -219,7 +219,6 @@
 	return l[i].target < l[j].target
 }
 
-
 // annotated describes annotated test data edges to define test graphs.
 type annotated struct {
 	target, dep string
@@ -240,7 +239,7 @@
 	if e.dep != other.dep {
 		return false
 	}
-        if len(e.annotations) != len(other.annotations) {
+	if len(e.annotations) != len(other.annotations) {
 		return false
 	}
 	a1 := append([]string{}, e.annotations...)
@@ -401,7 +400,7 @@
 }
 
 // Len returns the count of elements in the slice.
-func (l actionList) Len() int      { return len(l) }
+func (l actionList) Len() int { return len(l) }
 
 // Swap rearranges 2 elements of the slice so that each occupies the other's
 // former position.
@@ -467,10 +466,10 @@
 		oprivacy := fields[0]
 		cprivacy := fields[1]
 		result = append(result, SourceSharePrivacyConflict{
-				newTestNode(lg, c.sourceNode),
-				newTestCondition(lg, oshare, cshare),
-				newTestCondition(lg, oprivacy, cprivacy),
-			})
+			newTestNode(lg, c.sourceNode),
+			newTestCondition(lg, oshare, cshare),
+			newTestCondition(lg, oprivacy, cprivacy),
+		})
 	}
 	return result
 }