Golang Project Structure

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

I. Overview

Golang updated the environment variables, resulting in a structural change of the entire goproject:

1[root@node175 goproject]# Tree-l22 .3 ├──bin4 │└──demo5 ├──pkg6 │└──linux_amd647 └──src8 ├──demo9 Ten 5Directories,1file One  A Project source code under SRC, can contain multiple project:demo1, Demo2 and so on - at this time bin, pkg are empty directory; -CD src &&Go Install demo the #此时, the Lib file that generated the demo project is in the following directory -[root@node175 src]# LL.. /pkg/linux_amd64/demo/ -Total dosage4 --rw-r--r--1Root root914September -  One: $LIB.A +  -# At this point, the executable file is generated in the. /Bin directory: +[root@node175 src]# LL.. /bin/ ATotal dosage1620 at-rwxr-xr-x1Root root1654812September -  One: -Demo

Why is the build goproject so laid out?

The answer is in the Go Env related configuration in the/etc/profile file;

1 export goroot=/root/xxx/go  2 export gopath=/root/xxx/goproject3 Export gobin=/root/xxx/goproject/4 export golib=/root/xxx/goproject/5

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.