Skip to content

Commit 6a4e730

Browse files
author
Steve Ruckdashel
authored
crypto/secp256k1: add workaround for go mod vendor (#21735)
Go won't vendor C files if there are no Go files present in the directory. Workaround is to add dummy Go files. Fixes: #20232
1 parent 581c028 commit 6a4e730

File tree

8 files changed

+69
-0
lines changed

8 files changed

+69
-0
lines changed

crypto/secp256k1/dummy.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// +build dummy
2+
3+
// This file is part of a workaround for `go mod vendor` which won't vendor
4+
// C files if there's no Go file in the same directory.
5+
// This would prevent the crypto/secp256k1/libsecp256k1/include/secp256k1.h file to be vendored.
6+
//
7+
// This Go file imports the c directory where there is another dummy.go file which
8+
// is the second part of this workaround.
9+
//
10+
// These two files combined make it so `go mod vendor` behaves correctly.
11+
//
12+
// See this issue for reference: https://github.com/golang/go/issues/26366
13+
14+
package secp256k1
15+
16+
import (
17+
_ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/include"
18+
_ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src"
19+
_ "github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1/src/modules/recovery"
20+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package contrib
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package libsecp256k1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package include
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package src
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package module
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package ecdh
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build dummy
2+
3+
// Package c contains only a C file.
4+
//
5+
// This Go file is part of a workaround for `go mod vendor`.
6+
// Please see the file crypto/secp256k1/dummy.go for more information.
7+
package recovery

0 commit comments

Comments
 (0)