All Projects → dearplain → Goloader

dearplain / Goloader

Licence: apache-2.0
load and run golang code at runtime. (WARNING: this repo has not been maintained for a long time, please take a look at https://github.com/pkujhd/goloader)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
script
160 projects

Projects that are alternatives of or similar to Goloader

Axbaseplugin
Android Plugin Framework
Stars: ✭ 122 (-78.37%)
Mutual labels:  plugin, dynamic
Homebridge Fritz Platform
AiO Homebridge dynamic platform plugin for AVM hardware like Fritz!Box, Fritz!Repeater etc.
Stars: ✭ 101 (-82.09%)
Mutual labels:  plugin, dynamic
Hr4r
Example project - "Hot Reloading 4 RequireJS" front-end web applications & some extra code demonstrating hot-reloading for Node.js Express servers
Stars: ✭ 28 (-95.04%)
Mutual labels:  dynamic, hot-reload
Grassbending
A replacement for Unity's terrain grass shader with alpha blended rendering and touch bending effect
Stars: ✭ 397 (-29.61%)
Mutual labels:  plugin, dynamic
Goloader
load and run golang code at runtime.
Stars: ✭ 159 (-71.81%)
Mutual labels:  plugin, dynamic
Glean
hotfix for go applications via plugin, supports Linux and MacOS
Stars: ✭ 125 (-77.84%)
Mutual labels:  plugin, hot-reload
Cp Ddd Framework
A lightweight flexible development framework for complex business architecture with full ecosystem!轻量级业务中台开发框架,中台架构的顶层设计和完整解决方案!
Stars: ✭ 566 (+0.35%)
Mutual labels:  plugin, hot-reload
React Native Wormhole
⚛️ 🌌 Inter-dimensional Portals for React Native. 👽 🖖
Stars: ✭ 133 (-76.42%)
Mutual labels:  plugin, dynamic
flutter dynamic
The flutter_dynamic is a library that create flutter application dynamic.
Stars: ✭ 66 (-88.3%)
Mutual labels:  dynamic, hot-reload
Webpack Pwa Manifest
Progressive Web App Manifest Generator for Webpack, with auto icon resizing and fingerprinting support.
Stars: ✭ 447 (-20.74%)
Mutual labels:  plugin, hot-reload
Typescript Plugin Css Modules
A TypeScript language service plugin providing support for CSS Modules.
Stars: ✭ 520 (-7.8%)
Mutual labels:  plugin
Terraform Provisioner Ansible
Ansible with Terraform 0.13.x
Stars: ✭ 520 (-7.8%)
Mutual labels:  plugin
Easyclangcomplete
💥 Robust C/C++ code completion for Sublime Text 3
Stars: ✭ 537 (-4.79%)
Mutual labels:  plugin
Hexo Tag Aplayer
Embed aplayer in Hexo posts/pages
Stars: ✭ 552 (-2.13%)
Mutual labels:  plugin
Poster Girl L2d 2233
🍬 The live2d poster girl plugin of 22&33 for WordPress
Stars: ✭ 517 (-8.33%)
Mutual labels:  plugin
Paroller.js
Parallax scrolling jQuery plugin
Stars: ✭ 535 (-5.14%)
Mutual labels:  plugin
Elastalert Kibana Plugin
ElastAlert Kibana Plugin
Stars: ✭ 515 (-8.69%)
Mutual labels:  plugin
Dss
🔥 Dynamic Style Sheets
Stars: ✭ 514 (-8.87%)
Mutual labels:  dynamic
Vimoutliner
Work fast, think well.
Stars: ✭ 507 (-10.11%)
Mutual labels:  plugin
Flask State
Display machine state using Python3 with Flask.
Stars: ✭ 553 (-1.95%)
Mutual labels:  plugin

Goloader

Build Status

Goloader can load and run Golang code at runtime.

How does it work?

Goloader works like a linker: it relocates the address of symbols in an object file, generates runnable code, and then reuses the runtime function and the type pointer of the loader.

Goloader provides some information to the runtime and gc of Go, which allows it to work correctly with them.

Please note that Goloader is not a scripting engine. It reads the output of Go compiler and makes them runnable. All features of Go are supported, and run just as fast and lightweight as native Go code.

Comparison with plugin

Goloader reuses the Go runtime, which makes it much smaller. And code loaded by Goloader is unloadable.

Goloader is debuggable, and supports pprof tool(Yes, you can see code loaded by Goloader in pprof).

Build

Make sure you're using go >= 1.8.

First, execute the following command, then do build and test. This is because Goloader relies on the internal package, which is forbidden by the Go compiler.

cp -r $GOROOT/src/cmd/internal $GOROOT/src/cmd/objfile

Examples

go build github.com/dearplain/goloader/examples/loader

go tool compile $GOPATH/src/github.com/dearplain/goloader/examples/schedule/schedule.go
./loader -o schedule.o -run main.main -times 10

go tool compile $GOPATH/src/github.com/dearplain/goloader/examples/base/base.go
./loader -o base.o -run main.main

go tool compile $GOPATH/src/github.com/dearplain/goloader/examples/http/http.go
./loader -o http.o -run main.main

#build multiple go files
go tool compile -I $GOPATH/pkg/darwin_amd64 1.go 2.go

#build for arm32
GOOS=linux GOARCH=arm GOARM=5 go install fmt runtime sync net/http time
GOOS=linux GOARCH=arm GOARM=5 go build github.com/dearplain/goloader/examples/loader
GOOS=linux GOARCH=arm GOARM=5 go tool compile $GOPATH/src/github.com/dearplain/goloader/examples/base/base.go
#test on arm32 linux
./loader -o base.o -run main.main

Warning

This has currently only been tested and developed on Golang 1.8, 1.9, and 1.10 (x64/x86, darwin, linux, windows). Be aware of Golang's internal structs change, especially the moduledata struct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].