Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Use Rails to generate Golang code or manage Go app development
go-on-rails
is a Rails generator aims to:
Here's some examples:
Add this line to your application's Gemfile:
gem 'go-on-rails', '~> 0.4.0'
And then execute:
$ bundle
Or install it yourself as:
$ gem install go-on-rails
You must have an existed Rails app or to create a new one before you try go-on-rails to generate Golang codes.
After that you can run the command just as other Rails generators:
rails g gor [dev(elopment) | pro(duction) | test | ...] [-m model_a model_b model_c ...]
# OR (on rails version < 5.0)
rake g gor ...
here we take generating all models for the development
environment for example:
rails g gor dev
Then a folder named go_app
that includes Golang codes will be generated under your Rails app root path.
Install the dependent Golang packages for this Go project:
rails gor:deps
Then change to the go_app
directory and run:
go run main.go
You can visit the page in http://localhost:4000 by default.
More command details about go-on-rails generator:
rails g gor --help
go_app
directory, like views
, controllers
, public
)go_app/models
directorygo_app/models/doc
main.go
and controllers
programsYou can view the godoc page of all functions in http://localhost:7979/doc/models.html after run:
rails gor:doc
Besides, there's a sample project generated by go-on-rails, you can view its godoc at godoc.org just now to get a picture of what functions are generated.
The gem is still under development, so there're some known issues. You're welcomed to contribute. 👏
database/sql
database API libraryWhen I had the idea to convert Rails app or build Golang app with Rails tools, I searched github and found the project: https://github.com/t-k/ar2gostruct. And from ar2gostruct I copied some codes on handling data structure convertion and models association, it make my idea come true faster than I imagined.
There're two branches at present: master
and dev
.
The dev
branch has a whole Rails environment for development: models, seeds for testing, and under go_app
directory there's a file named models_test.go
used to test generated Golang codes.
dev
.We create four models for testing:
Run rails db:seed
to use the data defined in db/seeds.rb
. And change to go_app/models
directory to run go test
to test generated models-related functions. The test covers a small part of the functions currently. More will be added later on.
See the LICENSE file.
FAQs
Unknown package
We found that go-on-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.