Skip to content

Commit

Permalink
moved example to example func in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed Mar 28, 2024
1 parent 4b27d97 commit 4791ad3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 0 additions & 14 deletions cmd/gocert/main.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
package main

import (
"fmt"

"github.com/canonical/gocert/internal/certdb"
)

var db *certdb.CertificateRequests

func main() {
db = new(certdb.CertificateRequests)
if err := db.Connect("./certs.db", "CertificateReq"); err != nil {
fmt.Println(err)
}
defer db.Disconnect()

// ListenAndServe
}
9 changes: 9 additions & 0 deletions internal/certdb/certdb_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package certdb_test

import (
"log"
"strings"
"testing"

Expand Down Expand Up @@ -106,3 +107,11 @@ func TestRetrieve(t *testing.T) {
}

}

func ExampleConnection() {

Check failure on line 111 in internal/certdb/certdb_test.go

View workflow job for this annotation

GitHub Actions / go-vet

ExampleConnection refers to unknown identifier: Connection
db := new(certdb.CertificateRequests)
if err := db.Connect("./certs.db", "CertificateReq"); err != nil {
log.Fatalln(err)
}
defer db.Disconnect()
}

0 comments on commit 4791ad3

Please sign in to comment.