Introduction to basic application of go language and common commands

Time:2022-1-5
catalogue
  • Introduction to go language
  • Main features of go language [key points]
  • Go language application
  • Common commands in go language
  • Visibility rules in go language [key]

Introduction to basic application of go language and common commands

Introduction to go language

Go is a compiled system programming language that is open source, supports concurrency and garbage collection. It was developed by Robert Griesemer, rob pike and Ken Thompson at the end of 2007. Later, it joined LAN lance Taylor, Russ Cox and others. It was finally open source in November 2009 and released the stable version of go 1 in early 2012.

Main features of go language [key points]

  1. Object oriented without inheritance polymorphism
  2. Strong consistency type
  3. The interface does not need to display a declaration
  4. No exception handling
  5. Acronym based accessibility
  6. Unused imports or variables cause compilation errors
  7. Perfect and excellent standard library package
  8. Go language is a compiled static type language, which can directly operate memory through pointers
  9. Type safety and memory safety;
  10. Achieve high concurrency [concurrent programming] with a very intuitive and very low-cost scheme;
  11. Efficient garbage collection mechanism (built-in runtime);
  12. Fast compilation (solve the problem of too many header files in C language at the same time);
  13. The scheme function that provides performance improvement for multi-core computers can return multiple values

Go language application

Server programming: processing logs, data packaging, file system, etc;

Distributed system: database processor, middleware, etc;

Network programming: the most widely used piece at present, web application, API Application, etc;

Cloud platform: at present, the cloud platform is gradually implemented by go;

Blockchain development

Development of large game server

Common commands in go language

Go get: get the remote package (you need to install git or Hg in advance);

Go run: run the program directly;

Go build: project release;

Go FMT: format source code (some ides are called automatically when saving);

Go install: compile the package file and compile the whole program;

Go test: run the test file;

Go doc: view the document;

Go help: View

Go command line;

Visibility rules in go language [key]

In go language, case is used to determine whether the constant, variable, type, interface and structure can be called externally
If the first letter of the function name is lowercase, it is private, and if the first letter of the function name is uppercase, it is public.

The above is the introduction to the basics of go language and the details of common commands. For more information about go language, please pay attention to other relevant articles of developeppaper!