Go Language Engineering Management

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

1. Establishment of the project

1---setting $gopath environment variables

For example, add the following statement to the ~/.BASHRC export $GOPAHT =/home/jj/goproj

(Don't forget the source ~/.BASHRC)

2--set up the engineering catalogue

Cd/home/jj

mkdir goproj

CD Goproj

mkdir src (this folder must be named SRC)

Mkdr Bin (this folder can be arbitrarily named)

3--adding source files in src directory

CD./src

Vim main. Go (main name is not required, can be any name)

MkDir Lib

CD./lib

Vim Lib1.go (edit a library for Main.go call, can be multiple, and the name is arbitrary)

2. Compiling the project

CD $GOPATH/bin

Go build main (must be with the file in src directory always, because go will search under $GOPATH/SRCZ, its dependent libraries do not have to be compiled separately, go will automatically deduce)

The main program is generated in the Bin directory when the compilation is complete.

3. Complete Engineering directory Structure

<goproj>

|--------<src>

| |-------main.go

| |-------<lib>

| |-------lib1.go

|---------<bin>

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.