Skip to content

Commit

Permalink
chore: use go mod vendor for patching (evcc-io#4669)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Oct 1, 2022
1 parent 008ef7f commit c80b622
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ soc:

# patch asn1.go to allow Elli buggy certificates to be accepted with EEBUS
patch-asn1:
echo $$(go env GOROOT)
cat $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
patch -N -t -d $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte -i $$(pwd)/patch/asn1.diff
cat $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
# echo $$(go env GOROOT)
# cat $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
# patch -N -t -d $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte -i $$(pwd)/patch/asn1.diff
# cat $$(go env GOROOT)/src/vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
go mod vendor
cat vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
patch -N -t -d vendor/golang.org/x/crypto/cryptobyte -i $$(pwd)/patch/asn1.diff
cat vendor/golang.org/x/crypto/cryptobyte/asn1.go | grep -C 1 "out = true"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ require (
github.com/volkszaehler/mbmd v0.0.0-20220916215221-af29846c997e
github.com/writeas/go-strip-markdown v2.0.1+incompatible
gitlab.com/bboehmke/sunny v0.15.1-0.20211022160056-2fba1c86ade6
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094
Expand Down Expand Up @@ -157,7 +158,6 @@ require (
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
Expand Down
16 changes: 16 additions & 0 deletions patch_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"testing"

"github.com/stretchr/testify/assert"
"golang.org/x/crypto/cryptobyte"
)

func TestPatch(t *testing.T) {
var res bool
b := cryptobyte.String([]byte{0x01, 0x01, 0x01})
ok := b.ReadASN1Boolean(&res)
assert.True(t, ok, "read failed")
assert.Equal(t, true, res, "patch failed")
}

0 comments on commit c80b622

Please sign in to comment.