当前位置:网站首页>Go language learning
Go language learning
2022-07-27 06:47:00 【lianyz1985】
Set up Go environment variable
stay /etc/profile or ~/.zshrc Set environment variables in
export GOROOT=/users/lianyz/.go/current
export GOPATH=/users/lianyz/go
export GOPROXY=https://goproxy.cn
export GOPRIVATE=*.lianyz.com
GOPRIVATE For private warehouses , In order to let GOPROXY Skip these warehouses , Direct connection is adopted
go mod Package management
When in $GOPATH/src Create a directory under the directory and execute go mod init when , There is no need to enter the module name ,go The module name will be directly generated according to the current path
go mod tidy Download the required dependencies and remove the unnecessary dependencies
go mod vendor Move the dependencies required by the project to the project vendor Under the table of contents , It can also be used to submit dependencies to the code warehouse .
Makefile Example
export tag=v1.1
root:
export ROOT=github.com/cncamp/golang
.PHONY: root
build:
echo "building httpserver binary"
mkdir -p bin/amd64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/amd64 .
release: build
echo "building httpserver container"
docker build -t lianyz/httpserver:${tag} .
push: release
echo "pushing lianyz/httpserver"
docker push lianyz/httpserver:${tag}
Dockerfile Example
FROM alpine
ENV MY_SERVICE_PORT=80
ENV MY_SERVICE_PORT1=80
ENV MY_SERVICE_PORT2=80
ENV MY_SERVICE_PORT3=80
LABEL multi.lable1="value1" multi.label2="value2" other="value3"
ADD bin/amd64/httpserver /httpserver
EXPOSE 80
ENTRYPOINT /httpserver
stay GoLand Set spell check rule file in
- create a file ~/.lianyz.dic
- Add words to the file , One word one line , Such as : lianyz
- Add the file to GoLand->Preferences->Editor->Proofreading->Spelling Medium Dictionaries.
边栏推荐
猜你喜欢

改善宝宝过敏就吃伊敏舒,azg与Aibeca爱楽倍佳携手守护中国宝宝成长

Cesium tutorial (1) interface introduction -3dfiles loading - change mouse operation settings

1. Install redis in CentOS 7

Multimodal database | star ring technology multimode database argodb "one database for multiple purposes", building a high-performance Lake warehouse integrated platform

关于在Gazebo中给无人机添加相机(摄像头)之后,无人机无法起飞

向日葵:遇到电脑漏洞别担心,了解清楚再判断向日葵:遇到电脑漏洞别担心,了解清楚再判断向日葵:遇到电脑漏洞别担心,了解清楚再判断向日葵:遇到电脑漏洞别担心,了解清楚再判断向日葵:遇到电脑漏洞别担心,了解

Lamp -- source code compilation and installation

Joint query of database

PXE efficient batch network installation

Use of getattr, hasattr, delattr and setattr in reflectors
随机推荐
Redis fast learning
Shell script loop
多模态数据库 | 星环科技多模数据库ArgoDB“一库多用“,构建高性能湖仓集一体平台
pymysql查询查询结果转换json
To improve the baby's allergy, take yiminshu. Azg and aibeca love la Beijia work together to protect the growth of Chinese babies
If conditional statement of shell
Linu performance tuning: how can we alleviate the situation in the face of DDoS attacks?
Kaggle calls the custom module method
Joint query of database
2022上半年英特尔有哪些“硬核创新”?看这张图就知道了!
About the problem that Druid can't connect to the database
pycharm在虚拟环境下跑jupyter notebook问题记录
Go语言学习
3D打印品牌的康复骨科支具有何特别之处?
备忘录 @RestControllerAdvice与异常拦截类示例
Shell -- circular statements (for, while, until)
1. Install redis in CentOS 7
keras-ocr实例测试
众多世界500强企业集聚第二届数博会,数字产业大幕即将开启!
Shell script one click configuration lamp