check / check (push) Failing after 2s
script/lint-darwin (make lint-darwin; run by script/check, and its commands by the Dockerfile lint stage) runs go vet and golangci-lint with GOOS=darwin and cgo off. Compiling cgo for macOS needs Apple's SDK, so the three functions that call go-keychain, which is cgo there, move to keychainunlocker_cgo.go; a macOS build without cgo gets keychainunlocker_nocgo.go and the macse stub, whose errors name the missing macOS build with cgo. The rest of the keychain unlocker and its plain-Go tests are now checked; their findings are fixed without changing behaviour, and lines over 88 columns in the unchecked files are wrapped. Model: opus-5-5
31 lines
831 B
Go
31 lines
831 B
Go
//go:build darwin && !cgo
|
|
|
|
package secret
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/awnumar/memguard"
|
|
)
|
|
|
|
// In a macOS build without cgo, these take the place of the functions in
|
|
// keychainunlocker_cgo.go: go-keychain is cgo on macOS, so they can only fail.
|
|
|
|
var errKeychainNotSupported = errors.New(
|
|
"keychain unlockers need a macOS build with cgo")
|
|
|
|
// storeInKeychain fails: the keychain needs a macOS build with cgo.
|
|
func storeInKeychain(_ string, _ *memguard.LockedBuffer) error {
|
|
return errKeychainNotSupported
|
|
}
|
|
|
|
// retrieveFromKeychain fails: the keychain needs a macOS build with cgo.
|
|
func retrieveFromKeychain(_ string) ([]byte, error) {
|
|
return nil, errKeychainNotSupported
|
|
}
|
|
|
|
// deleteFromKeychain fails: the keychain needs a macOS build with cgo.
|
|
func deleteFromKeychain(_ string) error {
|
|
return errKeychainNotSupported
|
|
}
|