当前位置:网站首页>Environmental preparation - Engineering Management
Environmental preparation - Engineering Management
2022-06-29 07:53:00 【qazw9600】
explain
- Project management is project management ,go The language provides workspace management , Source code management , The third party relies on specifications such as library management .
- go Is the engineering language , Not as free as college language , Some specifications have been made for project management .
work area (workspace) management
- go Language programming , It is not easy to create a directory as a working directory , Because it depends on file search and intermediate 、 Generation of target file , And the installation of executable files ,go There are certain specifications for the directory structure of the workspace and the designation of the workspace .
- Of course, if the project has only a single source file or multiple files, but the import package path is written to the absolute path, it can also be compiled , But this is not recommended .
View and set up
- go The default workspace will be set after the environment is installed , And create a default directory structure under this directory ,linux for ~/go/.
- go adopt GOPATH The environment variable sets the workspace path , It can be modified manually , However, you need to manually create these subdirectories after modification .
- see
go env GOPATH
- Set up
export $GOPAHT=/xxx/xxx
- Be careful :GOPATH You can set multiple , But if you set multiple paths , Need to set up GOBIN Environment variables to determine which directory the executable is placed in .
Directory structure
- The workspace contains 3 Subdirectory .
- src Catalog : Store project source code , A project is divided into a subdirectory , go get The downloaded third-party packages are also placed in this directory .
- pkg Catalog : Storage via go install Command to build the installed “.a” The archive .
- bin Catalog : And pkg Similar directory , Through go install After the command is installed , Save by Go Command source file generated executable file .
Develop and improve
- GOPATH The mechanism is primitive and simple , In the process of development, it shows some deficiencies , for example :
- The code must be in GOPATH The next path src Directory , Otherwise , Importing the package in the project will prompt that it cannot be found .
- Dependent packages need to be managed manually , No version number information .
- …
- The official management mechanism is also improving , Experienced GOPATH、go vendor, At present, the latest and mainstream official mechanism is go mod.
Source code and third-party dependency library management
- go Both source code and third-party dependency libraries are organized and managed in the form of source code packages .
Engineering example
- Create a project
- Early creation of a new project needs to be done in the workspace src Under the table of contents , But with go mod The mechanism does not need , Can be created in any directory .
- Create a project root directory , for example :example, Put the code in the root directory .
- Compile and install
- The compilation needs to be executed under the root directory of the project “go build” command ,go The compiler will automatically derive the dependencies , The compiled executable name is the project name .
- The installation needs to be executed in the same directory “go install”,go The compiler will place the generated file in the... Of the workspace bin and pkg Next .
- A single file program can also compile the file directly , as follows :
go build xxx.go
边栏推荐
- Schnuka: visual positioning system manufacturer what is a visual positioning system
- Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200
- 数组知识点小结
- Detailed explanation of route (Jiuyang Scripture)
- Vulnhub's dc7 target
- Postman pre request
- Kingbasees coping with transaction rollback caused by too fast growth of table age
- 软重启(reboot)
- 【修复收藏功能、更新登录接口】知识付费小程序、博客小程序、完整版开源源码、资源变现小程序,带299整站资源数据
- [old horse of industrial control] detailed explanation of Siemens PLC s7-300scl programming
猜你喜欢

C实战——高配版贪吃蛇游戏设计

【工控老马】PLC六路抢答器系统设计详解

Electric check code configuration

1032 Sharing

低配MySQL数据库几十秒插入百万数据
![[industrial control old horse] detailed explanation of design principle of pattern fountain based on PLC](/img/28/690f9985f32675f5d50d196c293abe.jpg)
[industrial control old horse] detailed explanation of design principle of pattern fountain based on PLC

4年工作经验,多线程间的5种通信方式都说不出来,你敢信?

【量化投资系统】因子处理安装talib

jsp学习部分
![[industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC](/img/c5/9383a02050c83b26bb56f4045b0774.png)
[industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC
随机推荐
C编译器 - 隐式函数声明
打包时提示: Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘
TF. Repeat and stack operations of slim
How to share the virtual environment of pycharm to jupyter Lab
Kyushu cloud helps Inner Mongolia's "counting from the east to the west" project to drive the smart new ecology of the surveying and mapping industry
AC自动机
【工控老马】PLC六路抢答器系统设计详解
从Nacos客户端谈Nacos配置中心
MIPS instruction set and brief analysis
719. find the distance of the number pair with the smallest K (two points)
SQL 注入绕过(六)
RobotFramework学习笔记:Robot Framework和BrowserLibrary(PlayWright)简介
Kingbasees v8r6 cluster maintenance case -- single instance data migration to cluster case
Codeforces Round #799 (Div. 4)
Schnuka: 3D visual inspection scheme 3D visual inspection application industry
Vulnhub's dc7 target
ES中配置ext.dic文件不生效的原因
Detailed explanation of route (Jiuyang Scripture)
编译原理王者之路
VMware vcenter/ESXI系列漏洞总结