GO Engineering structure

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Go is a programming language that advocates software engineering concepts.
The go code must be placed in the workspace. A workspace is actually a directory that corresponds to a specific project, and it should contain three subdirectories:
SRC is used to organize and save go source files in the form of a code package. Should be divided into three categories: library source code files, command source files, test source files.
Pkg is used to store the ". A" archive of the installed code package (library source file) built by the Go Install command. Like the pkg feature in the Goroot directory, the difference is that the PKG directory in the working directory is designed to hold the archive file for user code.
When the bin is installed through the Go Install command, the executable file generated by the Go command source file is saved.

PS: The so-called command source files, which can be run independently, can be converted into executable files by Go build or go Install command. Library source file refers to a code package of common source files.

Set Gopath
$vim/etc/profile
Export gopath= $HOME/golang/lib: $HOME/golang/learngo
$source/etc/profile

$HOME/golang/lib for storing third-party code libraries (go get command)
$HOME/golang/learngo to store learning code

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.