Skip to content

Getting Started

Development environment installation

Create Application

  • cmd: energy init
  • run cmd
    1. Input app name
    2. Select HTTP
  • Waiting for automatic creation and initialization of projects and dependency configurations

Input app name

init_name

Select resource load options

init_http

Enter,waiting

init_success

Run app

1. Enter the project directory

2. run go cmd: go run main.go

Linux-ARM(64)

  1. export LD_PRELOAD="$ENERGY_HOME/libcef.so"
  2. go run main.go

directory structure

dir_struct

NameTypeDESC
resourcesfolderThe resource storage directory is created during initialization and can be customized or deleted
config/energy_[os].jsonfileProject configuration file, created at initialization, file name cannot be modified, used for building and creating installation packages.
go.mod, go.sumfileGo module management, automatically generated
README.mdfileThe project description file, created during initialization, describes the current directory structure
main.gofileEnergy Go applies the project main function to launch the entry file

MacOS

For the Mac M(series) architecture, the development environment is the same as the Mac AMD64.

When cross-compiling for Mac M(series) or amd64, you need to enable CGO support by setting CGO_ENABLED=1

Running amd64 applications on Mac M(series) requires running AMD64 architecture applications through Rosetta2 compatibility

Additional installation required

  1. GCC toolchain brew install gcc, Installation may also be requiredxcode-select --install
  2. Rosetta2 Reference link

Compilation environment setting

  • Cross environment: GOARCH=amd64
  • Open CGO: CGO_ENABLED=1

GO
ENERGY