Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeken committed Nov 25, 2015
1 parent 5f810fd commit d173cb5
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func FromBase64(v []byte) (Buffer, error) {
// (I made that name up)
func FromNData(v []byte) (Buffer, error) {
size := binary.BigEndian.Uint32(v)
buf := make([]byte, int(size))
buf := make([]byte, int(size))
copy(buf, v[4:4+size])
return Buffer(buf), nil
}
Expand Down
4 changes: 2 additions & 2 deletions buffer/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestFunky(t *testing.T) {
func TestBuffer_NData(t *testing.T) {
payload := []byte("Alice")
nd := Buffer(payload).NData()
if !assert.Equal(t, []byte{0,0,0,5,65,108,105,99,101}, nd, "NData mathces") {
if !assert.Equal(t, []byte{0, 0, 0, 5, 65, 108, 105, 99, 101}, nd, "NData mathces") {
return
}

Expand All @@ -90,4 +90,4 @@ func TestBuffer_NData(t *testing.T) {
if !assert.Equal(t, payload, b1.Bytes(), "payload matches") {
return
}
}
}
2 changes: 1 addition & 1 deletion cmd/jwx/jwx.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ func doJWK() int {
}

return 1
}
}
2 changes: 1 addition & 1 deletion internal/concatkdf/concatkdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ func (k *KDF) Read(buf []byte) (int, error) {
n := copy(buf, k.buf[:len(buf)])
k.buf = k.buf[len(buf):]
return n, nil
}
}
2 changes: 1 addition & 1 deletion internal/concatkdf/concatkdf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ func TestAppendix(t *testing.T) {
if !assert.Equal(t, expected, out, "generated value matches") {
return
}
}
}
2 changes: 1 addition & 1 deletion internal/emap/emap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ func TestRoundTrip(t *testing.T) {
if !assert.Equal(t, d1, d2) {
return
}
}
}
2 changes: 1 addition & 1 deletion internal/padbuf/padbuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ func (pb PadBuffer) Unpad(n int) (PadBuffer, error) {
}

return PadBuffer(pb[:pb.Len()-int(last)]), nil
}
}
2 changes: 1 addition & 1 deletion jwe/aescbc/aescbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ func (c AesCbcHmac) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
out := ret[len(dst):]
copy(out, plaintext)
return ret, nil
}
}
2 changes: 1 addition & 1 deletion jwe/cipher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ func TestAesContentCipher(t *testing.T) {
}
t.Logf("keysize = %d", c.KeySize())
}
}
}
2 changes: 1 addition & 1 deletion jwe/keywrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ func TestRFC3394_Wrap(t *testing.T) {
return
}
}
}
}
2 changes: 1 addition & 1 deletion jwk/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ func Example() {
}
// Use key for jws.Verify() or whatever
_ = key
}
}
2 changes: 1 addition & 1 deletion jwk/ecdhes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ func NewEcdhesPublicKey(key *ecdsa.PublicKey, keyalg jwa.KeyEncryptionAlgorithm,
UInfo: apu,
VInfo: apv,
}
}
}
2 changes: 1 addition & 1 deletion jwk/ecdhes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ func TestECDHES_KeyAgreement(t *testing.T) {
_ = k
_ = conskeysrc
_ = epksrc
}
}
2 changes: 1 addition & 1 deletion jwk/jwk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ func TestAppendix_A3(t *testing.T) {
return
}
}
}
}
4 changes: 2 additions & 2 deletions jws/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ type MultiSign struct {
}

type HmacSign struct {
Public *Header
Protected *Header
Public *Header
Protected *Header
Key []byte
hash func() hash.Hash
}
Expand Down
2 changes: 1 addition & 1 deletion jws/jws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestParse_CompactSerializationBadSignature(t *testing.T) {
func TestRoundtrip_HMAC(t *testing.T) {
payload := []byte("Lorem ipsum")
sharedkey := []byte("Avracadabra")
for _, alg := range []jwa.SignatureAlgorithm{ jwa.HS256, jwa.HS384, jwa.HS512 } {
for _, alg := range []jwa.SignatureAlgorithm{jwa.HS256, jwa.HS384, jwa.HS512} {
signed, err := Sign(payload, alg, sharedkey)
if !assert.NoError(t, err, "Sign succeeds") {
return
Expand Down
38 changes: 19 additions & 19 deletions jws/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,32 +157,32 @@ func (h1 *EssentialHeader) Merge(h2 *EssentialHeader) {
}

func (h1 *Header) Copy(h2 *Header) error {
if h1 == nil {
return errors.New("copy destination is nil")
}
if h2 == nil {
return errors.New("copy target is nil")
}
if h1 == nil {
return errors.New("copy destination is nil")
}
if h2 == nil {
return errors.New("copy target is nil")
}

h1.EssentialHeader.Copy(h2.EssentialHeader)
h1.EssentialHeader.Copy(h2.EssentialHeader)

for k, v := range h2.PrivateParams {
h1.PrivateParams[k] = v
}
for k, v := range h2.PrivateParams {
h1.PrivateParams[k] = v
}

return nil
return nil
}

func (h1 *EssentialHeader) Copy(h2 *EssentialHeader) {
h1.Algorithm = h2.Algorithm
h1.ContentType = h2.ContentType
h1.Algorithm = h2.Algorithm
h1.ContentType = h2.ContentType
h1.JwkSetURL = h2.JwkSetURL
h1.KeyID = h2.KeyID
h1.Type = h2.Type
h1.X509Url = h2.X509Url
h1.X509CertChain = h2.X509CertChain
h1.X509CertThumbprint = h2.X509CertThumbprint
h1.X509CertThumbprintS256 = h2.X509CertThumbprintS256
h1.KeyID = h2.KeyID
h1.Type = h2.Type
h1.X509Url = h2.X509Url
h1.X509CertChain = h2.X509CertChain
h1.X509CertThumbprint = h2.X509CertThumbprint
h1.X509CertThumbprintS256 = h2.X509CertThumbprintS256
}

func (h Header) MarshalJSON() ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion jws/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ func (s JSONSerialize) Serialize(m *Message) ([]byte, error) {
return json.MarshalIndent(m, "", " ")
}
return json.Marshal(m)
}
}
2 changes: 1 addition & 1 deletion jws/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ func TestMultiSigner(t *testing.T) {

jsonbuf, _ := json.MarshalIndent(m, "", " ")
t.Logf("%s", jsonbuf)
}
}
2 changes: 1 addition & 1 deletion jwt/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ func TestClaimSet(t *testing.T) {
if !assert.Equal(t, c1, c2, "Claim sets match") {
return
}
}
}
2 changes: 1 addition & 1 deletion jwx.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
package jwx

// Version describes the version of this library.
const Version = "0.0.1"
const Version = "0.0.1"
2 changes: 1 addition & 1 deletion jwx_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ func ExampleJWE() {
log.Printf("WHAT?!")
return
}
}
}

0 comments on commit d173cb5

Please sign in to comment.