Fix some lint and vet issues

This commit is contained in:
Pim van Pelt
2025-08-28 21:17:37 +02:00
parent 7b3639ad69
commit 105a245239
10 changed files with 47 additions and 41 deletions

View File

@@ -16,7 +16,7 @@ import (
func TestGenerateHTML(t *testing.T) {
tmpDir := t.TempDir()
// Create test directories
testLogDir := filepath.Join(tmpDir, "test-log")
err := os.MkdirAll(testLogDir, 0755)
@@ -75,7 +75,7 @@ logs:
}
htmlStr := string(htmlContent)
// Check HTML contains expected elements
if !strings.Contains(htmlStr, "<!DOCTYPE html>") {
t.Error("Expected HTML doctype")
@@ -246,13 +246,13 @@ func TestGenerateLogJSONWithStatus(t *testing.T) {
testTime2, _ := time.Parse("2006-01-02T15:04:05Z", "2025-01-01T00:00:00Z")
logEntry := Log{
Origin: "test.example.com",
SubmissionPrefix: "https://test.example.com/submit",
MonitoringPrefix: "https://test.example.com/monitor",
NotAfterStart: testTime1,
NotAfterLimit: testTime2,
LogID: "dGVzdC1sb2ctaWQ=", // base64 encoded "test-log-id"
PublicKeyBase64: "dGVzdC1wdWJsaWMta2V5", // base64 encoded "test-public-key"
Origin: "test.example.com",
SubmissionPrefix: "https://test.example.com/submit",
MonitoringPrefix: "https://test.example.com/monitor",
NotAfterStart: testTime1,
NotAfterLimit: testTime2,
LogID: "dGVzdC1sb2ctaWQ=", // base64 encoded "test-log-id"
PublicKeyBase64: "dGVzdC1wdWJsaWMta2V5", // base64 encoded "test-public-key"
}
err := generateLogJSONWithStatus(logEntry, outputFile, false, true, false)
@@ -295,7 +295,7 @@ func TestGenerateLogJSONWithStatus(t *testing.T) {
func TestGenerateHTMLMissingDirectory(t *testing.T) {
tmpDir := t.TempDir()
// Create config with non-existent directory
configContent := `logs:
- shortname: "test-log"
@@ -313,4 +313,4 @@ func TestGenerateHTMLMissingDirectory(t *testing.T) {
// Should call log.Fatalf which exits the program
// We can't easily test this without subprocess, so we'll skip it
t.Skip("Cannot easily test log.Fatalf without subprocess")
}
}