code
stringlengths
11
335k
docstring
stringlengths
20
11.8k
func_name
stringlengths
1
100
language
stringclasses
1 value
repo
stringclasses
245 values
path
stringlengths
4
144
url
stringlengths
43
214
license
stringclasses
4 values
func (pk *PrivateKey) MarshalByteSecret() []byte { return pk.Seed() }
MarshalByteSecret returns the underlying seed of the private key.
MarshalByteSecret
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func (sk *PrivateKey) UnmarshalByteSecret(seed []byte) error { sk.Key = ed448lib.NewKeyFromSeed(seed) return nil }
UnmarshalByteSecret computes the private key from the secret seed and stores it in the private key object.
UnmarshalByteSecret
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func GenerateKey(rand io.Reader) (*PrivateKey, error) { publicKey, privateKey, err := ed448lib.GenerateKey(rand) if err != nil { return nil, err } privateKeyOut := new(PrivateKey) privateKeyOut.PublicKey.Point = publicKey[:] privateKeyOut.Key = privateKey[:] return privateKeyOut, nil }
GenerateKey generates a fresh private key with the provided randomness source.
GenerateKey
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func Sign(priv *PrivateKey, message []byte) ([]byte, error) { // Ed448 is used with the empty string as a context string. // See https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-08#section-13.7 return ed448lib.Sign(priv.Key, message, ""), nil }
Sign signs a message with the ed448 algorithm. priv MUST be a valid key! Check this with Validate() before use.
Sign
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func Verify(pub *PublicKey, message []byte, signature []byte) bool { // Ed448 is used with the empty string as a context string. // See https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-08#section-13.7 return ed448lib.Verify(pub.Point, message, signature, "") }
Verify verifies a ed448 signature
Verify
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func Validate(priv *PrivateKey) error { expectedPrivateKey := ed448lib.NewKeyFromSeed(priv.Seed()) if subtle.ConstantTimeCompare(priv.Key, expectedPrivateKey) == 0 { return errors.KeyInvalidError("ed448: invalid ed448 secret") } if subtle.ConstantTimeCompare(priv.PublicKey.Point, expectedPrivateKey[SeedSize:]) == 0 { return errors.KeyInvalidError("ed448: invalid ed448 public key") } return nil }
Validate checks if the ed448 private key is valid
Validate
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func WriteSignature(writer io.Writer, signature []byte) error { _, err := writer.Write(signature) return err }
WriteSignature encodes and writes an ed448 signature to writer.
WriteSignature
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func ReadSignature(reader io.Reader) ([]byte, error) { signature := make([]byte, SignatureSize) if _, err := io.ReadFull(reader, signature); err != nil { return nil, err } return signature, nil }
ReadSignature decodes an ed448 signature from a reader.
ReadSignature
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/ed448/ed448.go
MIT
func Decode(in io.Reader) (p *Block, err error) { r := bufio.NewReaderSize(in, 100) var line []byte ignoreNext := false TryNextBlock: p = nil // Skip leading garbage for { ignoreThis := ignoreNext line, ignoreNext, err = r.ReadLine() if err != nil { return } if ignoreNext || ignoreThis { continue } line = bytes.TrimSpace(line) if len(line) > len(armorStart)+len(armorEndOfLine) && bytes.HasPrefix(line, armorStart) { break } } p = new(Block) p.Type = string(line[len(armorStart) : len(line)-len(armorEndOfLine)]) p.Header = make(map[string]string) nextIsContinuation := false var lastKey string // Read headers for { isContinuation := nextIsContinuation line, nextIsContinuation, err = r.ReadLine() if err != nil { p = nil return } if isContinuation { p.Header[lastKey] += string(line) continue } line = bytes.TrimSpace(line) if len(line) == 0 { break } i := bytes.Index(line, []byte(":")) if i == -1 { goto TryNextBlock } lastKey = string(line[:i]) var value string if len(line) > i+2 { value = string(line[i+2:]) } p.Header[lastKey] = value } p.lReader.in = r p.oReader.lReader = &p.lReader p.oReader.b64Reader = base64.NewDecoder(base64.StdEncoding, &p.lReader) p.Body = &p.oReader return }
Decode reads a PGP armored block from the given Reader. It will ignore leading garbage. If it doesn't find a block, it will return nil, io.EOF. The given Reader is not usable after calling this function: an arbitrary amount of data may have been read past the end of the block.
Decode
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/armor/armor.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/armor/armor.go
MIT
func crc24(crc uint32, d []byte) uint32 { for _, b := range d { crc ^= uint32(b) << 16 for i := 0; i < 8; i++ { crc <<= 1 if crc&0x1000000 != 0 { crc ^= crc24Poly } } } return crc }
crc24 calculates the OpenPGP checksum as specified in RFC 4880, section 6.1
crc24
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
MIT
func writeSlices(out io.Writer, slices ...[]byte) (err error) { for _, s := range slices { _, err = out.Write(s) if err != nil { return err } } return }
writeSlices writes its arguments to the given Writer.
writeSlices
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
MIT
func Encode(out io.Writer, blockType string, headers map[string]string) (w io.WriteCloser, err error) { return encode(out, blockType, headers, true) }
Encode returns a WriteCloser which will encode the data written to it in OpenPGP armor.
Encode
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
MIT
func EncodeWithChecksumOption(out io.Writer, blockType string, headers map[string]string, doChecksum bool) (w io.WriteCloser, err error) { return encode(out, blockType, headers, doChecksum) }
EncodeWithChecksumOption returns a WriteCloser which will encode the data written to it in OpenPGP armor and provides the option to include a checksum. When forming ASCII Armor, the CRC24 footer SHOULD NOT be generated, unless interoperability with implementations that require the CRC24 footer to be present is a concern.
EncodeWithChecksumOption
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/armor/encode.go
MIT
func NewPrivateKey(key PublicKey) *PrivateKey { return &PrivateKey{ PublicKey: key, } }
NewPrivateKey creates a new empty private key including the public key.
NewPrivateKey
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func Validate(pk *PrivateKey) (err error) { var expectedPublicKey, privateKey x448lib.Key subtle.ConstantTimeCopy(1, privateKey[:], pk.Secret) x448lib.KeyGen(&expectedPublicKey, &privateKey) if subtle.ConstantTimeCompare(expectedPublicKey[:], pk.PublicKey.Point) == 0 { return errors.KeyInvalidError("x448: invalid key") } return nil }
Validate validates that the provided public key matches the private key.
Validate
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func GenerateKey(rand io.Reader) (*PrivateKey, error) { var privateKey, publicKey x448lib.Key privateKeyOut := new(PrivateKey) err := generateKey(rand, &privateKey, &publicKey) if err != nil { return nil, err } privateKeyOut.PublicKey.Point = publicKey[:] privateKeyOut.Secret = privateKey[:] return privateKeyOut, nil }
GenerateKey generates a new x448 key pair.
GenerateKey
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func Encrypt(rand io.Reader, publicKey *PublicKey, sessionKey []byte) (ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, err error) { var ephemeralPrivate, ephemeralPublic, staticPublic, shared x448lib.Key // Check that the input static public key has 56 bytes. if len(publicKey.Point) != KeySize { err = errors.KeyInvalidError("x448: the public key has the wrong size") return nil, nil, err } copy(staticPublic[:], publicKey.Point) // Generate ephemeral keyPair. if err = generateKey(rand, &ephemeralPrivate, &ephemeralPublic); err != nil { return nil, nil, err } // Compute shared key. ok := x448lib.Shared(&shared, &ephemeralPrivate, &staticPublic) if !ok { err = errors.KeyInvalidError("x448: the public key is a low order point") return nil, nil, err } // Derive the encryption key from the shared secret. encryptionKey := applyHKDF(ephemeralPublic[:], publicKey.Point[:], shared[:]) ephemeralPublicKey = &PublicKey{ Point: ephemeralPublic[:], } // Encrypt the sessionKey with aes key wrapping. encryptedSessionKey, err = keywrap.Wrap(encryptionKey, sessionKey) if err != nil { return nil, nil, err } return ephemeralPublicKey, encryptedSessionKey, nil }
Encrypt encrypts a sessionKey with x448 according to the OpenPGP crypto refresh specification section 5.1.7. The function assumes that the sessionKey has the correct format and padding according to the specification.
Encrypt
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func Decrypt(privateKey *PrivateKey, ephemeralPublicKey *PublicKey, ciphertext []byte) (encodedSessionKey []byte, err error) { var ephemeralPublic, staticPrivate, shared x448lib.Key // Check that the input ephemeral public key has 56 bytes. if len(ephemeralPublicKey.Point) != KeySize { err = errors.KeyInvalidError("x448: the public key has the wrong size") return nil, err } copy(ephemeralPublic[:], ephemeralPublicKey.Point) subtle.ConstantTimeCopy(1, staticPrivate[:], privateKey.Secret) // Compute shared key. ok := x448lib.Shared(&shared, &staticPrivate, &ephemeralPublic) if !ok { err = errors.KeyInvalidError("x448: the ephemeral public key is a low order point") return nil, err } // Derive the encryption key from the shared secret. encryptionKey := applyHKDF(ephemeralPublicKey.Point[:], privateKey.PublicKey.Point[:], shared[:]) // Decrypt the session key with aes key wrapping. encodedSessionKey, err = keywrap.Unwrap(encryptionKey, ciphertext) if err != nil { return nil, err } return encodedSessionKey, nil }
Decrypt decrypts a session key stored in ciphertext with the provided x448 private key and ephemeral public key.
Decrypt
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func EncodedFieldsLength(encryptedSessionKey []byte, v6 bool) int { lenCipherFunction := 0 if !v6 { lenCipherFunction = 1 } return KeySize + 1 + len(encryptedSessionKey) + lenCipherFunction }
EncodeFieldsLength returns the length of the ciphertext encoding given the encrypted session key.
EncodedFieldsLength
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func EncodeFields(writer io.Writer, ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, cipherFunction byte, v6 bool) (err error) { lenAlgorithm := 0 if !v6 { lenAlgorithm = 1 } if _, err = writer.Write(ephemeralPublicKey.Point); err != nil { return err } if _, err = writer.Write([]byte{byte(len(encryptedSessionKey) + lenAlgorithm)}); err != nil { return err } if !v6 { if _, err = writer.Write([]byte{cipherFunction}); err != nil { return err } } if _, err = writer.Write(encryptedSessionKey); err != nil { return err } return nil }
EncodeField encodes x448 session key encryption fields as ephemeral x448 public key | follow byte length | cipherFunction (v3 only) | encryptedSessionKey and writes it to writer.
EncodeFields
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func DecodeFields(reader io.Reader, v6 bool) (ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, cipherFunction byte, err error) { var buf [1]byte ephemeralPublicKey = &PublicKey{ Point: make([]byte, KeySize), } // 56 octets representing an ephemeral x448 public key. if _, err = io.ReadFull(reader, ephemeralPublicKey.Point); err != nil { return nil, nil, 0, err } // A one-octet size of the following fields. if _, err = io.ReadFull(reader, buf[:]); err != nil { return nil, nil, 0, err } followingLen := buf[0] // The one-octet algorithm identifier, if it was passed (in the case of a v3 PKESK packet). if !v6 { if _, err = io.ReadFull(reader, buf[:]); err != nil { return nil, nil, 0, err } cipherFunction = buf[0] followingLen -= 1 } // The encrypted session key. encryptedSessionKey = make([]byte, followingLen) if _, err = io.ReadFull(reader, encryptedSessionKey); err != nil { return nil, nil, 0, err } return ephemeralPublicKey, encryptedSessionKey, cipherFunction, nil }
DecodeField decodes a x448 session key encryption as ephemeral x448 public key | follow byte length | cipherFunction (v3 only) | encryptedSessionKey.
DecodeFields
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/x448/x448.go
MIT
func encodeCount(i int) uint8 { if i < 65536 || i > 65011712 { panic("count arg i outside the required range") } for encoded := 96; encoded < 256; encoded++ { count := decodeCount(uint8(encoded)) if count >= i { return uint8(encoded) } } return 255 }
encodeCount converts an iterative "count" in the range 1024 to 65011712, inclusive, to an encoded count. The return value is the octet that is actually stored in the GPG file. encodeCount panics if i is not in the above range (encodedCount above takes care to pass i in the correct range). See RFC 4880 Section 3.7.7.1.
encodeCount
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func decodeCount(c uint8) int { return (16 + int(c&15)) << (uint32(c>>4) + 6) }
decodeCount returns the s2k mode 3 iterative "count" corresponding to the encoded octet c.
decodeCount
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func encodeMemory(memory uint32, parallelism uint8) uint8 { if memory < (8*uint32(parallelism)) || memory > uint32(2147483648) { panic("Memory argument memory is outside the required range") } for exp := 3; exp < 31; exp++ { compare := decodeMemory(uint8(exp)) if compare >= memory { return uint8(exp) } } return 31 }
encodeMemory converts the Argon2 "memory" in the range parallelism*8 to 2**31, inclusive, to an encoded memory. The return value is the octet that is actually stored in the GPG file. encodeMemory panics if is not in the above range See OpenPGP crypto refresh Section 3.7.1.4.
encodeMemory
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func decodeMemory(memoryExponent uint8) uint32 { return uint32(1) << memoryExponent }
decodeMemory computes the decoded memory in kibibytes as 2**memoryExponent
decodeMemory
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Simple(out []byte, h hash.Hash, in []byte) { Salted(out, h, in, nil) }
Simple writes to out the result of computing the Simple S2K function (RFC 4880, section 3.7.1.1) using the given hash and input passphrase.
Simple
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Salted(out []byte, h hash.Hash, in []byte, salt []byte) { done := 0 var digest []byte for i := 0; done < len(out); i++ { h.Reset() for j := 0; j < i; j++ { h.Write(zero[:]) } h.Write(salt) h.Write(in) digest = h.Sum(digest[:0]) n := copy(out[done:], digest) done += n } }
Salted writes to out the result of computing the Salted S2K function (RFC 4880, section 3.7.1.2) using the given hash, input passphrase and salt.
Salted
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Iterated(out []byte, h hash.Hash, in []byte, salt []byte, count int) { combined := make([]byte, len(in)+len(salt)) copy(combined, salt) copy(combined[len(salt):], in) if count < len(combined) { count = len(combined) } done := 0 var digest []byte for i := 0; done < len(out); i++ { h.Reset() for j := 0; j < i; j++ { h.Write(zero[:]) } written := 0 for written < count { if written+len(combined) > count { todo := count - written h.Write(combined[:todo]) written = count } else { h.Write(combined) written += len(combined) } } digest = h.Sum(digest[:0]) n := copy(out[done:], digest) done += n } }
Iterated writes to out the result of computing the Iterated and Salted S2K function (RFC 4880, section 3.7.1.3) using the given hash, input passphrase, salt and iteration count.
Iterated
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Argon2(out []byte, in []byte, salt []byte, passes uint8, paralellism uint8, memoryExp uint8) { key := argon2.IDKey(in, salt, uint32(passes), decodeMemory(memoryExp), paralellism, uint32(len(out))) copy(out[:], key) }
Argon2 writes to out the key derived from the password (in) with the Argon2 function (the crypto refresh, section 3.7.1.4)
Argon2
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Generate(rand io.Reader, c *Config) (*Params, error) { var params *Params if c != nil && c.Mode() == Argon2S2K { // handle Argon2 case argonConfig := c.Argon2() params = &Params{ mode: Argon2S2K, passes: argonConfig.Passes(), parallelism: argonConfig.Parallelism(), memoryExp: argonConfig.EncodedMemory(), } } else if c != nil && c.PassphraseIsHighEntropy && c.Mode() == SaltedS2K { // Allow SaltedS2K if PassphraseIsHighEntropy hashId, ok := algorithm.HashToHashId(c.hash()) if !ok { return nil, errors.UnsupportedError("no such hash") } params = &Params{ mode: SaltedS2K, hashId: hashId, } } else { // Enforce IteratedSaltedS2K method otherwise hashId, ok := algorithm.HashToHashId(c.hash()) if !ok { return nil, errors.UnsupportedError("no such hash") } if c != nil { c.S2KMode = IteratedSaltedS2K } params = &Params{ mode: IteratedSaltedS2K, hashId: hashId, countByte: c.EncodedCount(), } } if _, err := io.ReadFull(rand, params.salt()); err != nil { return nil, err } return params, nil }
Generate generates valid parameters from given configuration. It will enforce the Iterated and Salted or Argon2 S2K method.
Generate
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Parse(r io.Reader) (f func(out, in []byte), err error) { params, err := ParseIntoParams(r) if err != nil { return nil, err } return params.Function() }
Parse reads a binary specification for a string-to-key transformation from r and returns a function which performs that transform. If the S2K is a special GNU extension that indicates that the private key is missing, then the error returned is errors.ErrDummyPrivateKey.
Parse
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func ParseIntoParams(r io.Reader) (params *Params, err error) { var buf [Argon2SaltSize + 3]byte _, err = io.ReadFull(r, buf[:1]) if err != nil { return } params = &Params{ mode: Mode(buf[0]), } switch params.mode { case SimpleS2K: _, err = io.ReadFull(r, buf[:1]) if err != nil { return nil, err } params.hashId = buf[0] return params, nil case SaltedS2K: _, err = io.ReadFull(r, buf[:9]) if err != nil { return nil, err } params.hashId = buf[0] copy(params.salt(), buf[1:9]) return params, nil case IteratedSaltedS2K: _, err = io.ReadFull(r, buf[:10]) if err != nil { return nil, err } params.hashId = buf[0] copy(params.salt(), buf[1:9]) params.countByte = buf[9] return params, nil case Argon2S2K: _, err = io.ReadFull(r, buf[:Argon2SaltSize+3]) if err != nil { return nil, err } copy(params.salt(), buf[:Argon2SaltSize]) params.passes = buf[Argon2SaltSize] params.parallelism = buf[Argon2SaltSize+1] params.memoryExp = buf[Argon2SaltSize+2] return params, nil case GnuS2K: // This is a GNU extension. See // https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=doc/DETAILS;h=fe55ae16ab4e26d8356dc574c9e8bc935e71aef1;hb=23191d7851eae2217ecdac6484349849a24fd94a#l1109 if _, err = io.ReadFull(r, buf[:5]); err != nil { return nil, err } params.hashId = buf[0] if buf[1] == 'G' && buf[2] == 'N' && buf[3] == 'U' && buf[4] == 1 { return params, nil } return nil, errors.UnsupportedError("GNU S2K extension") } return nil, errors.UnsupportedError("S2K function") }
ParseIntoParams reads a binary specification for a string-to-key transformation from r and returns a struct describing the s2k parameters.
ParseIntoParams
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error { params, err := Generate(rand, c) if err != nil { return err } err = params.Serialize(w) if err != nil { return err } f, err := params.Function() if err != nil { return err } f(key, passphrase) return nil }
Serialize salts and stretches the given passphrase and writes the resulting key into key. It also serializes an S2K descriptor to w. The key stretching can be configured with c, which may be nil. In that case, sensible defaults will be used.
Serialize
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k.go
MIT
func (c *Cache) GetOrComputeDerivedKey(passphrase []byte, params *Params, expectedKeySize int) ([]byte, error) { key, found := (*c)[*params] if !found || len(key) != expectedKeySize { var err error derivedKey := make([]byte, expectedKeySize) s2k, err := params.Function() if err != nil { return nil, err } s2k(derivedKey, passphrase) (*c)[*params] = key return derivedKey, nil } return key, nil }
GetOrComputeDerivedKey tries to retrieve the key for the given s2k parameters from the cache. If there is no hit, it derives the key with the s2k function from the passphrase, updates the cache, and returns the key.
GetOrComputeDerivedKey
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k_cache.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k_cache.go
MIT
func (c *Config) EncodedCount() uint8 { if c == nil || c.S2KCount == 0 { return 224 // The common case. Corresponding to 16777216 } i := c.S2KCount switch { case i < 65536: i = 65536 case i > 65011712: i = 65011712 } return encodeCount(i) }
EncodedCount get encoded count
EncodedCount
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k_config.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/openpgp/s2k/s2k_config.go
MIT
func P256t1() elliptic.Curve { once.Do(initAll) return p256t1 }
P256t1 returns a Curve which implements Brainpool P256t1 (see RFC 5639, section 3.4)
P256t1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func P256r1() elliptic.Curve { once.Do(initAll) return p256r1 }
P256r1 returns a Curve which implements Brainpool P256r1 (see RFC 5639, section 3.4)
P256r1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func P384t1() elliptic.Curve { once.Do(initAll) return p384t1 }
P384t1 returns a Curve which implements Brainpool P384t1 (see RFC 5639, section 3.6)
P384t1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func P384r1() elliptic.Curve { once.Do(initAll) return p384r1 }
P384r1 returns a Curve which implements Brainpool P384r1 (see RFC 5639, section 3.6)
P384r1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func P512t1() elliptic.Curve { once.Do(initAll) return p512t1 }
P512t1 returns a Curve which implements Brainpool P512t1 (see RFC 5639, section 3.7)
P512t1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func P512r1() elliptic.Curve { once.Do(initAll) return p512r1 }
P512r1 returns a Curve which implements Brainpool P512r1 (see RFC 5639, section 3.7)
P512r1
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/brainpool/brainpool.go
MIT
func NewEAX(block cipher.Block) (cipher.AEAD, error) { return NewEAXWithNonceAndTagSize(block, defaultNonceSize, defaultTagSize) }
NewEAX returns an EAX instance with AES-{KEYLENGTH} and default nonce and tag lengths. Supports {128, 192, 256}- bit key length.
NewEAX
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/eax/eax.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/eax/eax.go
MIT
func NewEAXWithNonceAndTagSize( block cipher.Block, nonceSize, tagSize int) (cipher.AEAD, error) { if nonceSize < 1 { return nil, eaxError("Cannot initialize EAX with nonceSize = 0") } if tagSize > block.BlockSize() { return nil, eaxError("Custom tag length exceeds blocksize") } return &eax{ block: block, tagSize: tagSize, nonceSize: nonceSize, }, nil }
NewEAXWithNonceAndTagSize returns an EAX instance with AES-{keyLength} and given nonce and tag lengths in bytes. Panics on zero nonceSize and exceedingly long tags. It is recommended to use at least 12 bytes as tag length (see, for instance, NIST SP 800-38D). Only to be used for compatibility with existing cryptosystems with non-standard parameters. For all other cases, prefer NewEAX.
NewEAXWithNonceAndTagSize
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/eax/eax.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/eax/eax.go
MIT
func (e *eax) omacT(t byte, plaintext []byte) []byte { blockSize := e.block.BlockSize() byteT := make([]byte, blockSize) byteT[blockSize-1] = t concat := append(byteT, plaintext...) return e.omac(concat) }
Tweakable OMAC - Calls OMAC_K([t]_n || plaintext)
omacT
go
integrations/terraform-provider-github
vendor/github.com/ProtonMail/go-crypto/eax/eax.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/ProtonMail/go-crypto/eax/eax.go
MIT
func Run(file *ast.File, fset *token.FileSet, keywords ...string) []Message { if len(keywords) == 0 { keywords = defaultKeywords } var messages []Message for _, c := range file.Comments { for _, ci := range c.List { messages = append(messages, getMessages(ci, fset, keywords)...) } } return messages }
Run runs the godox linter on given file. Godox searches for comments starting with given keywords and reports them.
Run
go
integrations/terraform-provider-github
vendor/github.com/matoous/godox/godox.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/matoous/godox/godox.go
MIT
func getTestMap(ssaanalyzer *buildssa.SSA, testTyp types.Type) map[*ssa.Function][]*ssa.Function { testMap := map[*ssa.Function][]*ssa.Function{} trun := analysisutil.MethodOf(testTyp, "Run") for _, f := range ssaanalyzer.SrcFuncs { if !strings.HasPrefix(f.Name(), "Test") || !(f.Parent() == (*ssa.Function)(nil)) { continue } testMap[f] = []*ssa.Function{} for _, block := range f.Blocks { for _, instr := range block.Instrs { called := analysisutil.Called(instr, nil, trun) if !called && ssainstr.HasArgs(instr, types.NewPointer(testTyp)) { if instrs, ok := ssainstr.LookupCalled(instr, trun); ok { for _, v := range instrs { testMap[f] = appendTestMap(testMap[f], v) } } } else if called { testMap[f] = appendTestMap(testMap[f], instr) } } } } return testMap }
getTestMap gets a set of a top-level test and its sub-tests
getTestMap
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/testmap.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/testmap.go
MIT
func appendTestMap(subtests []*ssa.Function, instr ssa.Instruction) []*ssa.Function { call, ok := instr.(ssa.CallInstruction) if !ok { return subtests } ssaCall := call.Value() for _, arg := range ssaCall.Call.Args { switch arg := arg.(type) { case *ssa.Function: subtests = append(subtests, arg) case *ssa.MakeClosure: fn, _ := arg.Fn.(*ssa.Function) subtests = append(subtests, fn) } }
appendTestMap converts ssa.Instruction to ssa.Function and append it to a given sub-test slice
appendTestMap
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/testmap.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/testmap.go
MIT
func IsDeferCalled(f *ssa.Function) bool { for _, block := range f.Blocks { for _, instr := range block.Instrs { switch instr.(type) { case *ssa.Defer: return true } } }
IsDeferCalled returns whether the given ssa.Function calls `defer`
IsDeferCalled
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/pkg/ssafunc/ssafunc.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/pkg/ssafunc/ssafunc.go
MIT
func IsCalled(f *ssa.Function, fn *types.Func) bool { block := f.Blocks[0] for _, instr := range block.Instrs { called := analysisutil.Called(instr, nil, fn) if _, ok := ssainstr.LookupCalled(instr, fn); ok || called { return true } } return false }
IsCalled returns whether the given ssa.Function calls `fn` func
IsCalled
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/pkg/ssafunc/ssafunc.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/pkg/ssafunc/ssafunc.go
MIT
func LookupCalled(instr ssa.Instruction, fn *types.Func) ([]ssa.Instruction, bool) { instrs := []ssa.Instruction{} call, ok := instr.(ssa.CallInstruction) if !ok { return instrs, false } ssaCall := call.Value() if ssaCall == nil { return instrs, false } common := ssaCall.Common() if common == nil { return instrs, false } val := common.Value called := false switch fnval := val.(type) { case *ssa.Function: for _, block := range fnval.Blocks { for _, instr := range block.Instrs { if analysisutil.Called(instr, nil, fn) { called = true instrs = append(instrs, instr) } } } }
LookupCalled looks up ssa.Instruction that call the `fn` func in the given instr
LookupCalled
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/pkg/ssainstr/ssainstr.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/pkg/ssainstr/ssainstr.go
MIT
func HasArgs(instr ssa.Instruction, typ types.Type) bool { call, ok := instr.(ssa.CallInstruction) if !ok { return false } ssaCall := call.Value() if ssaCall == nil { return false } for _, arg := range ssaCall.Call.Args { if types.Identical(arg.Type(), typ) { return true } } return false }
HasArgs returns whether the given ssa.Instruction has `typ` type args
HasArgs
go
integrations/terraform-provider-github
vendor/github.com/moricho/tparallel/pkg/ssainstr/ssainstr.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/moricho/tparallel/pkg/ssainstr/ssainstr.go
MIT
func Decode(input interface{}, output interface{}) error { config := &DecoderConfig{ Metadata: nil, Result: output, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(input) }
Decode takes an input structure and uses reflection to translate it to the output structure. output must be a pointer to a map or struct.
Decode
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func WeakDecode(input, output interface{}) error { config := &DecoderConfig{ Metadata: nil, Result: output, WeaklyTypedInput: true, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(input) }
WeakDecode is the same as Decode but is shorthand to enable WeaklyTypedInput. See DecoderConfig for more info.
WeakDecode
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func DecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error { config := &DecoderConfig{ Metadata: metadata, Result: output, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(input) }
DecodeMetadata is the same as Decode, but is shorthand to enable metadata collection. See DecoderConfig for more info.
DecodeMetadata
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func WeakDecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error { config := &DecoderConfig{ Metadata: metadata, Result: output, WeaklyTypedInput: true, } decoder, err := NewDecoder(config) if err != nil { return err } return decoder.Decode(input) }
WeakDecodeMetadata is the same as Decode, but is shorthand to enable both WeaklyTypedInput and metadata collection. See DecoderConfig for more info.
WeakDecodeMetadata
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func NewDecoder(config *DecoderConfig) (*Decoder, error) { val := reflect.ValueOf(config.Result) if val.Kind() != reflect.Ptr { return nil, errors.New("result must be a pointer") } val = val.Elem() if !val.CanAddr() { return nil, errors.New("result must be addressable (a pointer)") } if config.Metadata != nil { if config.Metadata.Keys == nil { config.Metadata.Keys = make([]string, 0) } if config.Metadata.Unused == nil { config.Metadata.Unused = make([]string, 0) } if config.Metadata.Unset == nil { config.Metadata.Unset = make([]string, 0) } } if config.TagName == "" { config.TagName = "mapstructure" } if config.MatchName == nil { config.MatchName = strings.EqualFold } result := &Decoder{ config: config, } return result, nil }
NewDecoder returns a new decoder for the given configuration. Once a decoder has been returned, the same configuration must not be used again.
NewDecoder
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func (d *Decoder) Decode(input interface{}) error { err := d.decode("", input, reflect.ValueOf(d.config.Result).Elem()) // Retain some of the original behavior when multiple errors ocurr var joinedErr interface{ Unwrap() []error } if errors.As(err, &joinedErr) { return fmt.Errorf("decoding failed due to the following error(s):\n\n%w", err) } return err }
Decode decodes the given raw interface to the target pointer specified by the configuration.
Decode
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error { var inputVal reflect.Value if input != nil { inputVal = reflect.ValueOf(input) // We need to check here if input is a typed nil. Typed nils won't // match the "input == nil" below so we check that here. if inputVal.Kind() == reflect.Ptr && inputVal.IsNil() { input = nil } } if input == nil { // If the data is nil, then we don't set anything, unless ZeroFields is set // to true. if d.config.ZeroFields { outVal.Set(reflect.Zero(outVal.Type())) if d.config.Metadata != nil && name != "" { d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) } } return nil } if !inputVal.IsValid() { // If the input value is invalid, then we just set the value // to be the zero value. outVal.Set(reflect.Zero(outVal.Type())) if d.config.Metadata != nil && name != "" { d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) } return nil } if d.config.DecodeHook != nil { // We have a DecodeHook, so let's pre-process the input. var err error input, err = DecodeHookExec(d.config.DecodeHook, inputVal, outVal) if err != nil { return fmt.Errorf("error decoding '%s': %w", name, err) } } var err error outputKind := getKind(outVal) addMetaKey := true switch outputKind { case reflect.Bool: err = d.decodeBool(name, input, outVal) case reflect.Interface: err = d.decodeBasic(name, input, outVal) case reflect.String: err = d.decodeString(name, input, outVal) case reflect.Int: err = d.decodeInt(name, input, outVal) case reflect.Uint: err = d.decodeUint(name, input, outVal) case reflect.Float32: err = d.decodeFloat(name, input, outVal) case reflect.Complex64: err = d.decodeComplex(name, input, outVal) case reflect.Struct: err = d.decodeStruct(name, input, outVal) case reflect.Map: err = d.decodeMap(name, input, outVal) case reflect.Ptr: addMetaKey, err = d.decodePtr(name, input, outVal) case reflect.Slice: err = d.decodeSlice(name, input, outVal) case reflect.Array: err = d.decodeArray(name, input, outVal) case reflect.Func: err = d.decodeFunc(name, input, outVal) default: // If we reached this point then we weren't able to decode it return fmt.Errorf("%s: unsupported type: %s", name, outputKind) } // If we reached here, then we successfully decoded SOMETHING, so // mark the key as used if we're tracking metainput. if addMetaKey && d.config.Metadata != nil && name != "" { d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) } return err }
Decodes an unknown data type into a specific reflection value.
decode
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error { if val.IsValid() && val.Elem().IsValid() { elem := val.Elem() // If we can't address this element, then its not writable. Instead, // we make a copy of the value (which is a pointer and therefore // writable), decode into that, and replace the whole value. copied := false if !elem.CanAddr() { copied = true // Make *T copy := reflect.New(elem.Type()) // *T = elem copy.Elem().Set(elem) // Set elem so we decode into it elem = copy } // Decode. If we have an error then return. We also return right // away if we're not a copy because that means we decoded directly. if err := d.decode(name, data, elem); err != nil || !copied { return err } // If we're a copy, we need to set te final result val.Set(elem.Elem()) return nil } dataVal := reflect.ValueOf(data) // If the input data is a pointer, and the assigned type is the dereference // of that exact pointer, then indirect it so that we can assign it. // Example: *string to string if dataVal.Kind() == reflect.Ptr && dataVal.Type().Elem() == val.Type() { dataVal = reflect.Indirect(dataVal) } if !dataVal.IsValid() { dataVal = reflect.Zero(val.Type()) } dataValType := dataVal.Type() if !dataValType.AssignableTo(val.Type()) { return fmt.Errorf( "'%s' expected type '%s', got '%s'", name, val.Type(), dataValType) } val.Set(dataVal) return nil }
This decodes a basic type (bool, int, string, etc.) and sets the value to "data" of that type.
decodeBasic
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go
MIT
func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc { // Create variables here so we can reference them with the reflect pkg var f1 DecodeHookFuncType var f2 DecodeHookFuncKind var f3 DecodeHookFuncValue // Fill in the variables into this interface and the rest is done // automatically using the reflect package. potential := []interface{}{f1, f2, f3} v := reflect.ValueOf(h) vt := v.Type() for _, raw := range potential { pt := reflect.ValueOf(raw).Type() if vt.ConvertibleTo(pt) { return v.Convert(pt).Interface() } } return nil }
typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns it into the proper DecodeHookFunc type, such as DecodeHookFuncType.
typedDecodeHook
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func DecodeHookExec( raw DecodeHookFunc, from reflect.Value, to reflect.Value, ) (interface{}, error) { switch f := typedDecodeHook(raw).(type) { case DecodeHookFuncType: return f(from.Type(), to.Type(), from.Interface()) case DecodeHookFuncKind: return f(from.Kind(), to.Kind(), from.Interface()) case DecodeHookFuncValue: return f(from, to) default: return nil, errors.New("invalid decode hook signature") }
DecodeHookExec executes the given decode hook. This should be used since it'll naturally degrade to the older backwards compatible DecodeHookFunc that took reflect.Kind instead of reflect.Type.
DecodeHookExec
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc { return func(f reflect.Value, t reflect.Value) (interface{}, error) { var err error data := f.Interface() newFrom := f for _, f1 := range fs { data, err = DecodeHookExec(f1, newFrom, t) if err != nil { return nil, err } newFrom = reflect.ValueOf(data) } return data, nil } }
ComposeDecodeHookFunc creates a single DecodeHookFunc that automatically composes multiple DecodeHookFuncs. The composed funcs are called in order, with the result of the previous transformation.
ComposeDecodeHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func OrComposeDecodeHookFunc(ff ...DecodeHookFunc) DecodeHookFunc { return func(a, b reflect.Value) (interface{}, error) { var allErrs string var out interface{} var err error for _, f := range ff { out, err = DecodeHookExec(f, a, b) if err != nil { allErrs += err.Error() + "\n" continue } return out, nil } return nil, errors.New(allErrs) } }
OrComposeDecodeHookFunc executes all input hook functions until one of them returns no error. In that case its value is returned. If all hooks return an error, OrComposeDecodeHookFunc returns an error concatenating all error messages.
OrComposeDecodeHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToSliceHookFunc(sep string) DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.SliceOf(f) { return data, nil } raw := data.(string) if raw == "" { return []string{}, nil } return strings.Split(raw, sep), nil } }
StringToSliceHookFunc returns a DecodeHookFunc that converts string to []string by splitting on the given sep.
StringToSliceHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToTimeDurationHookFunc() DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(time.Duration(5)) { return data, nil } // Convert it by parsing return time.ParseDuration(data.(string)) } }
StringToTimeDurationHookFunc returns a DecodeHookFunc that converts strings to time.Duration.
StringToTimeDurationHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToIPHookFunc() DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(net.IP{}) { return data, nil } // Convert it by parsing ip := net.ParseIP(data.(string)) if ip == nil { return net.IP{}, fmt.Errorf("failed parsing ip %v", data) } return ip, nil } }
StringToIPHookFunc returns a DecodeHookFunc that converts strings to net.IP
StringToIPHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToIPNetHookFunc() DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(net.IPNet{}) { return data, nil } // Convert it by parsing _, net, err := net.ParseCIDR(data.(string)) return net, err } }
StringToIPNetHookFunc returns a DecodeHookFunc that converts strings to net.IPNet
StringToIPNetHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToTimeHookFunc(layout string) DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(time.Time{}) { return data, nil } // Convert it by parsing return time.Parse(layout, data.(string)) } }
StringToTimeHookFunc returns a DecodeHookFunc that converts strings to time.Time.
StringToTimeHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func WeaklyTypedHook( f reflect.Kind, t reflect.Kind, data interface{}, ) (interface{}, error) { dataVal := reflect.ValueOf(data) switch t { case reflect.String: switch f { case reflect.Bool: if dataVal.Bool() { return "1", nil } return "0", nil case reflect.Float32: return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil case reflect.Int: return strconv.FormatInt(dataVal.Int(), 10), nil case reflect.Slice: dataType := dataVal.Type() elemKind := dataType.Elem().Kind() if elemKind == reflect.Uint8 { return string(dataVal.Interface().([]uint8)), nil } case reflect.Uint: return strconv.FormatUint(dataVal.Uint(), 10), nil } } return data, nil }
WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to the decoder. Note that this is significantly different from the WeaklyTypedInput option of the DecoderConfig.
WeaklyTypedHook
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func TextUnmarshallerHookFunc() DecodeHookFuncType { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } result := reflect.New(t).Interface() unmarshaller, ok := result.(encoding.TextUnmarshaler) if !ok { return data, nil } str, ok := data.(string) if !ok { str = reflect.Indirect(reflect.ValueOf(&data)).Elem().String() } if err := unmarshaller.UnmarshalText([]byte(str)); err != nil { return nil, err } return result, nil } }
TextUnmarshallerHookFunc returns a DecodeHookFunc that applies strings to the UnmarshalText function, when the target type implements the encoding.TextUnmarshaler interface
TextUnmarshallerHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToNetIPAddrHookFunc() DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(netip.Addr{}) { return data, nil } // Convert it by parsing return netip.ParseAddr(data.(string)) } }
StringToNetIPAddrHookFunc returns a DecodeHookFunc that converts strings to netip.Addr.
StringToNetIPAddrHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToNetIPAddrPortHookFunc() DecodeHookFunc { return func( f reflect.Type, t reflect.Type, data interface{}, ) (interface{}, error) { if f.Kind() != reflect.String { return data, nil } if t != reflect.TypeOf(netip.AddrPort{}) { return data, nil } // Convert it by parsing return netip.ParseAddrPort(data.(string)) } }
StringToNetIPAddrPortHookFunc returns a DecodeHookFunc that converts strings to netip.AddrPort.
StringToNetIPAddrPortHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToBasicTypeHookFunc() DecodeHookFunc { return ComposeDecodeHookFunc( StringToInt8HookFunc(), StringToUint8HookFunc(), StringToInt16HookFunc(), StringToUint16HookFunc(), StringToInt32HookFunc(), StringToUint32HookFunc(), StringToInt64HookFunc(), StringToUint64HookFunc(), StringToIntHookFunc(), StringToUintHookFunc(), StringToFloat32HookFunc(), StringToFloat64HookFunc(), StringToBoolHookFunc(), // byte and rune are aliases for uint8 and int32 respectively // StringToByteHookFunc(), // StringToRuneHookFunc(), StringToComplex64HookFunc(), StringToComplex128HookFunc(), ) }
StringToBasicTypeHookFunc returns a DecodeHookFunc that converts strings to basic types. int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, float32, float64, bool, byte, rune, complex64, complex128
StringToBasicTypeHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToInt8HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Int8 { return data, nil } // Convert it by parsing i64, err := strconv.ParseInt(data.(string), 0, 8) return int8(i64), err } }
StringToInt8HookFunc returns a DecodeHookFunc that converts strings to int8.
StringToInt8HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToUint8HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Uint8 { return data, nil } // Convert it by parsing u64, err := strconv.ParseUint(data.(string), 0, 8) return uint8(u64), err } }
StringToUint8HookFunc returns a DecodeHookFunc that converts strings to uint8.
StringToUint8HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToInt16HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Int16 { return data, nil } // Convert it by parsing i64, err := strconv.ParseInt(data.(string), 0, 16) return int16(i64), err } }
StringToInt16HookFunc returns a DecodeHookFunc that converts strings to int16.
StringToInt16HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToUint16HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Uint16 { return data, nil } // Convert it by parsing u64, err := strconv.ParseUint(data.(string), 0, 16) return uint16(u64), err } }
StringToUint16HookFunc returns a DecodeHookFunc that converts strings to uint16.
StringToUint16HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToInt32HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Int32 { return data, nil } // Convert it by parsing i64, err := strconv.ParseInt(data.(string), 0, 32) return int32(i64), err } }
StringToInt32HookFunc returns a DecodeHookFunc that converts strings to int32.
StringToInt32HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToUint32HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Uint32 { return data, nil } // Convert it by parsing u64, err := strconv.ParseUint(data.(string), 0, 32) return uint32(u64), err } }
StringToUint32HookFunc returns a DecodeHookFunc that converts strings to uint32.
StringToUint32HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToInt64HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Int64 { return data, nil } // Convert it by parsing return strconv.ParseInt(data.(string), 0, 64) } }
StringToInt64HookFunc returns a DecodeHookFunc that converts strings to int64.
StringToInt64HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToUint64HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Uint64 { return data, nil } // Convert it by parsing return strconv.ParseUint(data.(string), 0, 64) } }
StringToUint64HookFunc returns a DecodeHookFunc that converts strings to uint64.
StringToUint64HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToIntHookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Int { return data, nil } // Convert it by parsing i64, err := strconv.ParseInt(data.(string), 0, 0) return int(i64), err } }
StringToIntHookFunc returns a DecodeHookFunc that converts strings to int.
StringToIntHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToUintHookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Uint { return data, nil } // Convert it by parsing u64, err := strconv.ParseUint(data.(string), 0, 0) return uint(u64), err } }
StringToUintHookFunc returns a DecodeHookFunc that converts strings to uint.
StringToUintHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToFloat32HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Float32 { return data, nil } // Convert it by parsing f64, err := strconv.ParseFloat(data.(string), 32) return float32(f64), err } }
StringToFloat32HookFunc returns a DecodeHookFunc that converts strings to float32.
StringToFloat32HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToFloat64HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Float64 { return data, nil } // Convert it by parsing return strconv.ParseFloat(data.(string), 64) } }
StringToFloat64HookFunc returns a DecodeHookFunc that converts strings to float64.
StringToFloat64HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToBoolHookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Bool { return data, nil } // Convert it by parsing return strconv.ParseBool(data.(string)) } }
StringToBoolHookFunc returns a DecodeHookFunc that converts strings to bool.
StringToBoolHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToByteHookFunc() DecodeHookFunc { return StringToUint8HookFunc() }
StringToByteHookFunc returns a DecodeHookFunc that converts strings to byte.
StringToByteHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToRuneHookFunc() DecodeHookFunc { return StringToInt32HookFunc() }
StringToRuneHookFunc returns a DecodeHookFunc that converts strings to rune.
StringToRuneHookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToComplex64HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Complex64 { return data, nil } // Convert it by parsing c128, err := strconv.ParseComplex(data.(string), 64) return complex64(c128), err } }
StringToComplex64HookFunc returns a DecodeHookFunc that converts strings to complex64.
StringToComplex64HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func StringToComplex128HookFunc() DecodeHookFunc { return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { if f.Kind() != reflect.String || t.Kind() != reflect.Complex128 { return data, nil } // Convert it by parsing return strconv.ParseComplex(data.(string), 128) } }
StringToComplex128HookFunc returns a DecodeHookFunc that converts strings to complex128.
StringToComplex128HookFunc
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go
MIT
func Join(errs ...error) error { n := 0 for _, err := range errs { if err != nil { n++ } } if n == 0 { return nil } e := &joinError{ errs: make([]error, 0, n), } for _, err := range errs { if err != nil { e.errs = append(e.errs, err) } } return e }
Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if every value in errs is nil. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string. A non-nil error returned by Join implements the Unwrap() []error method.
Join
go
integrations/terraform-provider-github
vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go
MIT
func GetLintingRules(config *lint.Config, extraRules []lint.Rule) ([]lint.Rule, error) { rulesMap := map[string]lint.Rule{} for _, r := range allRules { rulesMap[r.Name()] = r } for _, r := range extraRules { if _, ok := rulesMap[r.Name()]; ok { continue } rulesMap[r.Name()] = r } var lintingRules []lint.Rule for name, ruleConfig := range config.Rules { actualName := actualRuleName(name) r, ok := rulesMap[actualName] if !ok { return nil, fmt.Errorf("cannot find rule: %s", name) } if ruleConfig.Disabled { continue // skip disabled rules } lintingRules = append(lintingRules, r) } return lintingRules, nil }
GetLintingRules yields the linting rules that must be applied by the linter
GetLintingRules
go
integrations/terraform-provider-github
vendor/github.com/mgechev/revive/config/config.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/mgechev/revive/config/config.go
MIT
func GetConfig(configPath string) (*lint.Config, error) { config := &lint.Config{} switch { case configPath != "": config.Confidence = defaultConfidence err := parseConfig(configPath, config) if err != nil { return nil, err } default: // no configuration provided config = defaultConfig() } normalizeConfig(config) return config, nil }
GetConfig yields the configuration
GetConfig
go
integrations/terraform-provider-github
vendor/github.com/mgechev/revive/config/config.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/mgechev/revive/config/config.go
MIT
func GetFormatter(formatterName string) (lint.Formatter, error) { formatters := getFormatters() fmtr := formatters["default"] if formatterName != "" { f, ok := formatters[formatterName] if !ok { return nil, fmt.Errorf("unknown formatter %v", formatterName) } fmtr = f } return fmtr, nil }
GetFormatter yields the formatter for lint failures
GetFormatter
go
integrations/terraform-provider-github
vendor/github.com/mgechev/revive/config/config.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/mgechev/revive/config/config.go
MIT
func (k BranchKind) IsEmpty() bool { return k == Empty }
IsEmpty tests if the branch is empty
IsEmpty
go
integrations/terraform-provider-github
vendor/github.com/mgechev/revive/internal/ifelse/branch_kind.go
https://github.com/integrations/terraform-provider-github/blob/master/vendor/github.com/mgechev/revive/internal/ifelse/branch_kind.go
MIT