Skip to content

Commit 5f91d4b

Browse files
nabokihmsCopilot
andauthored
Allow compilation without CGO (dexidp#4266)
`ent` driver gives a normal error if the binary is compiled without CGO, but with our custom SQL driver Dex just fails to compile. ``` # github.com/dexidp/dex/cmd/dex cmd/dex/config.go:273:26: undefined: sql.SQLite3 cmd/dex/config.go:315:43: undefined: sql.SQLite3 ``` Signed-off-by: Maksim Nabokikh <[email protected]> Signed-off-by: Maksim Nabokikh <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent e572cd4 commit 5f91d4b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

storage/sql/sqlite_no_cgo.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build !cgo
2+
// +build !cgo
3+
4+
// This is a stub for the no CGO compilation (CGO_ENABLED=0)
5+
6+
package sql
7+
8+
import (
9+
"fmt"
10+
"log/slog"
11+
12+
"github.com/dexidp/dex/storage"
13+
)
14+
15+
type SQLite3 struct{}
16+
17+
func (s *SQLite3) Open(logger *slog.Logger) (storage.Storage, error) {
18+
return nil, fmt.Errorf("SQLite storage is not available: binary compiled without CGO support. Recompile with CGO_ENABLED=1 or use a different storage backend.")
19+
}

0 commit comments

Comments
 (0)