Powered by Function graph of Huawei cloud
prepare the .env
file in the root dictionary:
CONFIG_APPMODE=release # app mode: release or debug
CONFIG_PORT=:8000 # server port
CONFIG_MYSQL_ADDRESS=### # Mysql url
CONFIG_MYSQL_PORT=### # Mysql port
CONFIG_MYSQL_USER=### # Mysql username
CONFIG_MYSQL_PASS=### # Mysql password
CONFIG_MYSQL_DBNAME=### # Mysql database name
CONFIG_HUAWEI_USER=### # huawei cloud username
CONFIG_HUAWEI_IAMUSER=### # IAM username
CONFIG_HUAWEI_IAMPASS=### # IAM password
run the code
go run main.go
configure the linux:amd64 environment
set GOARCH=amd64
go env -w GOARCH=amd64
set GOOS=linux
go env -w GOOS=linux
build
# go build -o [目标可执行程序] [源程序]
#
go build -o go-http-demo main.go
restore the environment configuration
set GOARCH=amd64
go env -w GOARCH=amd64
set GOOS=windows
go env -w GOOS=windows