Use external main module

* renames main package so it's importable
* adds wrapmain sub-module as main module
This commit is contained in:
2023-08-08 20:58:22 +08:00
parent 265f7a5aa7
commit d730849b7e
26 changed files with 719 additions and 30 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"fmt"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"os"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"fmt"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"encoding/json"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"bufio"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"fmt"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"crypto/rand"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"math/big"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"bytes"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"bytes"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"fmt"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"context"
+5 -2
View File
@@ -15,7 +15,7 @@
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// geth is the official command-line client for Ethereum.
package main
package geth
import (
"fmt"
@@ -267,7 +267,10 @@ func init() {
}
}
func main() {
// FIXME workaround https://github.com/golang/go/issues/31354 by wrapping main
func main() { Main() }
func Main() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"fmt"
+7 -7
View File
@@ -1,4 +1,4 @@
package main
package geth
import (
"github.com/ethereum/go-ethereum/log"
@@ -105,18 +105,18 @@ func pluginsOnShutdown() {
func BlockChain(pl *plugins.PluginLoader) {
fnList := pl.Lookup("BlockChain", func(item interface{}) bool {
_, ok := item.(func())
return ok
_, ok := item.(func())
return ok
})
for _, fni := range fnList {
fni.(func())()
fni.(func())()
}
}
func pluginBlockChain() {
if plugins.DefaultPluginLoader == nil {
log.Warn("Attempting BlockChain, but default PluginLoader has not been initialized")
return
log.Warn("Attempting BlockChain, but default PluginLoader has not been initialized")
return
}
BlockChain(plugins.DefaultPluginLoader)
}
}
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"context"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"bytes"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"bytes"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"encoding/json"
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
package geth
import (
"encoding/json"