Skip to content

Commit

Permalink
Appease the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed Nov 12, 2024
1 parent 77471c9 commit efbffcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 39 deletions.
13 changes: 0 additions & 13 deletions cmd/conformance/mysql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var (
initSchemaPath = flag.String("init_schema_path", "", "Location of the schema file if database initialization is needed")
listen = flag.String("listen", ":2024", "Address:port to listen on")
privateKeyPath = flag.String("private_key_path", "", "Location of private key file")
publicKeyPath = flag.String("public_key_path", "", "Location of public key file")
additionalPrivateKeyPaths = []string{}
)

Expand Down Expand Up @@ -129,18 +128,6 @@ func createSignerOrDie(s string) note.Signer {
return noteSigner
}

func createVerifierOrDie() (string, note.Verifier) {
rawPublicKey, err := os.ReadFile(*publicKeyPath)
if err != nil {
klog.Exitf("Failed to read public key file %q: %v", *publicKeyPath, err)
}
noteVerifier, err := note.NewVerifier(string(rawPublicKey))
if err != nil {
klog.Exitf("Failed to create new verifier: %v", err)
}
return string(rawPublicKey), noteVerifier
}

// configureTilesReadAPI adds the API methods from https://c2sp.org/tlog-tiles to the mux,
// routing the requests to the mysql storage.
// This method could be moved into the storage API as it's likely this will be
Expand Down
25 changes: 0 additions & 25 deletions cmd/conformance/posix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (
storageDir = flag.String("storage_dir", "", "Root directory to store log data.")
initialise = flag.Bool("initialise", false, "Set when creating a new log to initialise the structure.")
listen = flag.String("listen", ":2025", "Address:port to listen on")
pubKeyFile = flag.String("public_key", "", "Location of public key file. If unset, uses the contents of the LOG_PUBLIC_KEY environment variable.")
privKeyFile = flag.String("private_key", "", "Location of private key file. If unset, uses the contents of the LOG_PRIVATE_KEY environment variable.")
additionalPrivateKeyFiles = []string{}
)
Expand Down Expand Up @@ -96,30 +95,6 @@ func main() {
}
}

// Read log public key from file or environment variable
func getVerifierOrDie() (string, note.Verifier) {
var pubKey string
var err error
if len(*pubKeyFile) > 0 {
pubKey, err = getKeyFile(*pubKeyFile)
if err != nil {
klog.Exitf("Unable to get public key: %q", err)
}
} else {
pubKey = os.Getenv("LOG_PUBLIC_KEY")
if len(pubKey) == 0 {
klog.Exit("Supply public key file path using --public_key or set LOG_PUBLIC_KEY environment variable")
}
}
// Check signatures
v, err := note.NewVerifier(pubKey)
if err != nil {
klog.Exitf("Failed to instantiate Verifier: %q", err)
}

return pubKey, v
}

func getSignersOrDie() (note.Signer, []note.Signer) {
s := getSignerOrDie()
a := []note.Signer{}
Expand Down
5 changes: 4 additions & 1 deletion internal/parse/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func TestCheckpointUnsafe(t *testing.T) {
func BenchmarkCheckpointUnsafe(b *testing.B) {
cpRaw := []byte("go.sum database tree\n31700353\nqINS1GRFhWHwdkUeqLEoP4yEMkTBBzxBkGwGQlVlVcs=\n\n— sum.golang.org Az3grnmrIUEDFqHzAElIQCPNoRFRAAdFo47fooyWKMHb89k11GJh5zHIfNCOBmwn/C3YI8oW9/C8DJ87F61QqspBYwM=")
for i := 0; i < b.N; i++ {
parse.CheckpointUnsafe(cpRaw)
_, _, err := parse.CheckpointUnsafe(cpRaw)
if err != nil {
b.Error(err)
}
}
}

0 comments on commit efbffcb

Please sign in to comment.