diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index cbdacd3e58b..681dde1bd27 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -146,8 +146,7 @@ func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretV return nil, fmt.Errorf("unable to decode public key: %v", err) } - var boxKey [32]byte - copy(boxKey[:], decodedPublicKey) + boxKey := [32]byte(decodedPublicKey) encryptedBytes, err := box.SealAnonymous([]byte{}, []byte(secretValue), &boxKey, crypto_rand.Reader) if err != nil { return nil, fmt.Errorf("box.SealAnonymous failed with error %w", err) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 0de3aed8183..b651d18a22e 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -153,8 +153,7 @@ func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretV return nil, fmt.Errorf("base64.StdEncoding.DecodeString was unable to decode public key: %v", err) } - var boxKey [32]byte - copy(boxKey[:], decodedPublicKey) + boxKey := [32]byte(decodedPublicKey) encryptedBytes, err := box.SealAnonymous([]byte{}, []byte(secretValue), &boxKey, crypto_rand.Reader) if err != nil { return nil, fmt.Errorf("box.SealAnonymous failed with error %w", err) diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 764af63e55c..2accf0b7df2 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -146,8 +146,7 @@ func encryptSecretWithPublicKey(publicKey *github.PublicKey, secretName, secretV return nil, fmt.Errorf("base64.StdEncoding.DecodeString was unable to decode public key: %v", err) } - var boxKey [32]byte - copy(boxKey[:], decodedPublicKey) + boxKey := [32]byte(decodedPublicKey) encryptedBytes, err := box.SealAnonymous([]byte{}, []byte(secretValue), &boxKey, crypto_rand.Reader) if err != nil { return nil, fmt.Errorf("box.SealAnonymous failed with error %w", err) diff --git a/github/github.go b/github/github.go index 1e79096856a..ea730039e0c 100644 --- a/github/github.go +++ b/github/github.go @@ -506,7 +506,7 @@ func (c *Client) copy() *Client { clone.client.Timeout = c.client.Timeout } c.rateMu.Lock() - copy(clone.rateLimits[:], c.rateLimits[:]) + clone.rateLimits = c.rateLimits c.rateMu.Unlock() return &clone }