-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Description
Projects that import restish as a library cannot build with CGO_ENABLED=0 since v0.21.0. The unconditional import of github.com/ThalesIgnite/crypto11 in cli/request.go pulls in github.com/miekg/pkcs11, which defines its core types in CGo files. When CGo is disabled, those types are excluded and compilation fails:
# github.com/ThalesIgnite/crypto11
crypto11.go:127:16: undefined: pkcs11.ObjectHandle
crypto11.go:174:14: undefined: pkcs11.Ctx
crypto11.go:177:16: undefined: pkcs11.TokenInfo
sessions.go:34:17: undefined: pkcs11.Ctx
...
This affects any consumer like us that embeds restish and cross-compiles with CGO_ENABLED=0. The previous versions up to v0.20.0 did not have this dependency and built cleanly without CGo.
Question
Would it be feasible to put the PKCS#11 functionality behind a build tag so that it's opt-in? That way library consumers who don't need hardware token support can continue building without CGo, while users who need PKCS#11 can enable it explicitly.