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
energy.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

Mac M1 M2

For the Mac ARM(M1, M2) architecture, the development environment is the same as for the Mac AMD64 In Mac ARM Go you need to use cross compilation, set the Go compilation environment to amd64, and CGO support Run AMD architecture applications with 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