Course name reading×
Two-dimensional code has expired, pleaseClick here to refresh
After paying the success of the page automatically jump, please do not close the window in the payment process.
Introduction to Go language programming
- 1 Course Introduction (free)
- 2 Trace (free)
- 3 language features and advantages and disadvantages (free)
- 4 development prospects (free)
- 5 learning suggestions (free)
- 1 Course Introduction (free)
- 2 install SDK (free)
- 3 configuration environment variables (free)
- 4 development tools (free)
- 5 Windows to build the development environment demonstration (free)
- 6 Linux to build the development environment demonstration (free)
- 7 Mac to build the development environment demonstration (free)
- 1 first Go program (free)
- 2 code simple instructions (free)
- 3 go program commonly used commands (free)
- 4 build go command description (free)
- 5 install go command description (free)
- 6 doc go command description (free)
- 7 other 3 commonly used commands (free)
- 1 identifier (free)
- 2 statement (free)
- 3 variable (free)
- 4 assignment (free)
- 5 notes (free)
- 1 integer (free)
- 2 floating point type (free)
- 3 string (free)
- 4 Boolean (free)
- 5 complex number (free)
- 1 constants (free)
- 2 batch declaration and iota keyword
- 3 scope of action
- 4 escape character
- 5 native string
- 6 arithmetic operation
- 7 arithmetic operations reminder
- 8 bit operation
- 9 comparison operation
- 10 logical operations
- 11 type conversion
- 12 declaration type
- 13 placeholders
- 14 pointer
- 15 pointer attention
- 1 composite type introduction
- 2 array
- 3 access array elements
- 4 pointers and arrays
- 5 multidimensional array
- Comparison of 6 arrays
- 7 initialize an array of advanced syntax
- 8 slice
- 9 slice initialization
- 10 make function to create slices
- 11 slice does not support comparison
- 12 slice append element
- 13 copy section
- 14 slice supplement
- 15 mapping
- 16 initialization map
- 17 access mapping
- 18 mapping other operations
- 19 mapping of the rich value type
- 20 structure
- 21 declarations and access structures
- 22 initialization structure
- 23 structure support comparison
- 24 nested and anonymous access
- Use 25 pointer structure
- 1 condition judgment (free)
- 2 multi conditional branches (free)
- 3 cycle (free)
- 4 jump (free)
- 1 function introduction
- Use 2 pointer
- 3 variable parameters
- 4 delay execution
- 5 function recursion
- 6 function is also type
- 7 anonymous function
- 1 method declaration
- 2 pointers and methods
- 3 structure embedding and method
- 4 method expression
- 5 methods supplement
- 1 interface introduction
- 2 interface embedded
- 3 interface conversion
- 4 interface value
- 5 types of assertions (free)
- 6 types of branches
- 7 interface and pointer
- 8 interface as a function parameter and return value
- 9 error
- 1 concurrent introduction
- 2 Go range
- 3 channel
- 4 no buffer channel
- 5 buffer channel
- 6 off channel
- 7 receive operation
- 8 pipe
- 9 one-way channel
- 10 multiplexing
- 11 panic
- 12 recovery
- 1 bags
- 2 package declaration
- 3 package import
- [course type]Technical course [difficulty level]senior [suitable for the crowd]All
- [course introduction]
Introduces the Go language related to the introduction and basic grammar, learn to develop the environment to build and use the Go language simple programming. This video tutorial is suitable for beginners Go language.
The first chapter mainly describes the development history and current situation of Go language, as well as the characteristics of the language itself, and it also shows the advantages and disadvantages of learning and using it. The second chapter describes how to set up a set of Go language development environment for learning test. The following chapters mainly explain the basic syntax of the Go language and some notes.
- [Course Project]
June years ago, the end of the course.
The first chapter: Introduction
From the current most fire Docker introduction to the Go language.
Trace to its source
Introduce the background of the Go language and the concept of absorbing the other language.
This paper introduces the characteristics of Go language and its attractive advantages, as well as its deficiencies.
This paper introduces the present development situation of Go language and the prospect of learning and using Go language.
According to their own learning experience in the past, to the majority of Go language newcomers to provide some suggestions as a reference.
The second chapter: building the development environment
Go language development environment to build a simple description of the contents of the environment.
A brief introduction to choose to install the SDK package, the need to download the corresponding Go language SDK version of the system according to the type and architecture of the system.
Configuration environment variable
This paper introduces the differences of Go language environment variable configuration in different systems.
This paper introduces the commonly used support Go language programming development tools, to provide reference for Go scholars.
Demonstrates how to build our own Go system under the Windows language development environment, including the SDK download and install, configure the system environment variables, install the Studio Code Visual editor.
Deepin depth system using Go to build the Linux language development environment to explain the reference.
The use of Go computer Mac language can also learn the video learn to build the Go language development environment.
The third chapter: NiuDao
First Go program
First Go code simple pressure Yajing, compile and run the Go program is what an exciting thing.
Code simple description
For our last class of the first paragraph of the code written in a simple note, including some attention, especially the novice often made a mistake, the left braces a new line from the new, which is not allowed in the Go language.
Go program commonly used commands
SDK in the Go program is a regular use of the program, with a variety of functions, we first list a number of commonly used command options.
Build go command description
Build go operation demonstration and precautions.
Install go command description
Install go compiler generates a binary file or library files and stored in the corresponding directory.
Doc go command description
Using doc go can view a variety of documents, or directly use the godoc program to achieve web page view of the document manual.
3 other commonly used commands
Run/get/fmt three common command instructions
The fourth chapter: program structure
Identifier is the Go source code for a variety of objects for our convenient access and do a variety of operations, and a variety of symbols to form a Go program.
Declares the identifier of various types to call access and operation in a subsequent step of the preparation procedure.
The first course variables, need to pay attention to, and the other variable declaration syntax format language slightly different types of variables in the variable name, and initializes the zero value.
Declare a variable may, we do not want to use the Go language automatic zero initialization statement, then you can use the assignment operation. Or use a variable to store a segment of the final result after a complex operation.
It is generally recommended that you add comments to the package and functions, with the same package that you only need to add a comment to a source file.
The fifth chapter: basic types
Integer type is our most commonly used basic data types, in accordance with the occupied figures can be subdivided into a variety of specific types.
Float64 provides a higher accuracy, the preparation of the program as far as possible to use the 64 bit float64 type.
Go language string and other languages have the same, there are many wonderful places, especially confusing, need to pay attention to Go scholars.
Used to judge the condition of true and false, only two kinds of values, true or false.
Mathematical disciplines, the general use of a relatively small.
The sixth chapter: Supplement
Constants are used to hold our constant values.
Batch declaration and iota keyword
Constants and variables can be declared using the small brackets (), the constant can also use the iota auto increment device declaration
Scope of action
The identifier determines the access order and scope of the object represented by the identifier.
Visualization can be achieved by using special characters and symbols of the escape character.
Two reverse quotes ` input content can be as output, even in the face of the escape character.
Each kind of basic data types support operations are not the same, a difference from other languages, does not support the integer increment and decrement prefix prefix, suffix suffix only increment and decrement, and separate statements, write code must go alone.
Arithmetic operation reminder
And other programming language of a very large difference, the two element operator on both sides of the data type must be completely consistent with the specific data type, otherwise the error.
Bit operations to achieve binary representation of the operation of the operation.
Compare the size of the two basic data types or whether they are equal, the result is a Boolean value true or false.
Returns a new Boolean value for the result of an expression to a Boolean value.
Go language default does not support the implicit data type conversion, at this time to use the new data type to save the original type value, you can use the mandatory display conversion, but there may be faced with the problem of loss of accuracy.
Declaration of a new type of packaging the original data type or structure, you can improve the code reuse and readability, reduce the complexity of the program, improve the efficiency of the development process.
To underline _ placeholder ignore references need not return values in the expression.
Go language to retain the C and C++ pointer, but there are similarities and differences.
Go language pointer is very powerful, but very safe, can not point to a constant or text, and does not support the C and C++ pointer arithmetic.
The seventh chapter: compound type
Composite type introduction
This chapter introduces the contents of the course, there are 4 kinds of composite types: arrays, sections, maps, and structures.
Describes the array of several syntax, including the initialization.
Accessing array elements
Array element values can be accessed by index index.
Pointers and arrays
By declaring a pointer to an array, you can also access the array, and the overhead is much smaller.
Go language also supports multidimensional arrays, a simple introduction to the multidimensional array of declarations and initialization.
The two arrays are equal, must be of the same array length, the same type of array, and the value of each element of the array. Otherwise not equal.
When the array can be initialized directly to specify an index index of the value of the index.
Second composite data types are introduced, as well as its declarative syntax.
Slices directly refer to an array, which can only be initialized with an array of partial or full elements.
Make function to create slices
Go language built-in make function can also create a slice, when you can specify the length and capacity of the creation, the other way of operation and the general statement of the same. Also demonstrates the difference with the general statement.
Slice does not support comparison
Slice and array of one of the big difference is that the array of support is equal and unequal, and the slice does not support, otherwise directly reported to the wrong.
Slice append element
The built-in append function can easily add elements to the slice, even if the storage capacity is not enough. In addition, sections can be automatically extended capacity.
Built in copy function to support the function of copy slice, relatively less.
Some additional instructions and precautions for slicing.
The mapping (map) type corresponds to the hash table of other programming languages or the concepts of dictionaries, associative arrays, etc. this section describes the syntax for declaring mappings and using make to create a mapping.
Two initialization methods are introduced.
Read mapping keys are similar to the internal array, slice method and.
Mapping other operations
The key to mapping support operations, depending on the value type, and can delete key on through the built-in delete function, len function can query the existing value of the total. Mapping does not support comparison.
Rich value type of mapping
The value type of the map not only supports basic data types, arrays, sections, and even maps, but also includes structures, functions, interfaces, and our custom types.
This paper introduces the definition of the structure and the syntax of the variable of the type of the structure.
Declaration and access structures
Support structure pointer variable or pointer variable. Through the dot can be directly read and write structure members value.
This paper introduces two methods of the nominal value of the initial structure.
Structure support comparison
Each member must be the structure of the data types are supported, can use the comparison operation = = = and.
Nested and anonymous access
Like inheritance to achieve access to nested anonymous structure members.
Use the pointer structure
Structure can not contain itself, but can use the pointer to achieve linked list, tree, and other complex data structure.
The eighth chapter: the control structure
If-else if-else implementation conditions to determine the implementation of
Multi conditional branch
Go language of the switch is very flexible and powerful, no longer can only use a fixed value to do branch judgment, you can use the comparison operation and logic operation mixed composition of the statement.
Go language only for keyword do loop operation, there is no while and do-while.
Call labels can achieve the code of the jump, especially in the face of multiple nested loop, if you want to jump out of the multi layer cycle, you can use break, continue and goto and tags.
The ninth chapter: function
This paper introduces some basic knowledge of Go language function.
The use of pointer
Pass the address to the pointer, can modify the argument variable values, while reducing the value of the huge resource overhead copy.
The variable parameter can be used when the transfer function is more than one of the same type parameters that are not known.
Defer used to delay the implementation of functions, mainly in order to release the creation of a variety of resources, such as open files, database connections, and so on.
Function internal statement calling itself called function recursion.
Function is also a type
In the Go language, functions are also used as types, you can declare a function type variable or assign a value to a variable.
Although the function declaration does not support nested new declaration functions, it supports nested declaration anonymous functions and calls.
The tenth chapter: method
Method is a function of the type binding, and the different types can have the same name as the method of the same name.
Pointers and methods
When the method is declared, the receiver can still use the pointer to receive the original value so as to modify the original value or reduce the memory usage of the transmitted value.
Structure embedding and method
The structure of embedded anonymous structure members, called the outer structure type for the first check whether there is no outer method, such as from top to bottom to check whether there is a method of the same name anonymous structure, need to pay attention to multiple anonymous structure methods with the same name ambiguity type.
Method can also be directly assigned to a variable, call methods and call the function of the same way, just add a list of parameters can be.
1 when the anonymous structure is used as a pointer type, just use the address code and the address to be used, and the remaining code is still.
2 any type of alias can be declared a method, not only the structure of the body type.
The eleventh chapter: Interface
Interface is a collection of multiple space methods, no member, you can store all types of data, only the type of implementation of all the methods in the interface, the implicit implementation of the interface.
Interface support embedded other interfaces, we call this interface embedded, the outer interface is equal to have all the inner interface of all methods.
The statement also mixed interface type and embedded Go language support routine.
Interfaces with more methods can be converted into interfaces that are only common parts, and vice versa.
The interface value holds the name of the data type and the specific value. The key point: the empty interface can save any data type, so it is often used.
Check whether the interface type variable is a specific type, combined with the if condition to determine whether to execute the following statement.
Switch branch statement combined with type to achieve a more clear and distinct interface variables to determine the specific types of inspection.
Interface and pointer
When the interface value method is called, the method of the type of the interface is modified by modifying the type of interface, and the receiver can be declared as a pointer type, and the interface value can be modified.
The interface can also be used as a function of a specific type as a function of the parameter, the function can return the value of the interface.
Go language will be used as a type of error processing, use the error keyword to represent the error, its essence is to contain only one string () Error method of the interface.
The twelfth chapter: concurrent
Go language is mainly used Go process (goroutine) and channel (channel) to write concurrent programs, development efficiency and implementation efficiency are satisfactory, which is the biggest highlight of the Go language to attract people.
Go process is distinguished from other concepts, such as process, thread, and other concepts, which is the unit of the corresponding function. The initial allocation stack is much smaller than the process or thread.
Channel is a common means of communication between Go range.
No buffer channel
No buffer channel is synchronized blocking, Go process must wait for the channel to receive and send operations before the end of the code can be executed.
Buffer channel, when the channel is empty, the receiver operation is blocked; when the channel is full, the transmission operation is blocked; other times are not blocked.
When we don't need to send data to the channel, we can use the close function to turn off the channel.
For the channel, in addition to the traditional receiver operating syntax, there is another kind of deformation of the receiver operating mode. At the same time, we can use for and range to realize the data in the channel.
The channels in turn are connected in series. Through the N channel can be connected in series Go n+1 connect operation.
The one-way channel is mainly used for the function to limit the channel whether the channel is only allowed to receive or send operation.
Using select statement to achieve multiplexing, when a channel to achieve the conditions immediately after the implementation of the case block. Random selection of a branch execution when multiple case branch conditions are satisfied.
Panic is run time error, the built-in panic function can cause panic.
With the aid of defer delay execution statement and recover function, you can make the program from panic to restore the implementation of follow-up code.
The thirteenth chapter: package
Go language use the package to organize the management code structure, corresponding to the Java in the package, C# namespace, etc..
The package can be composed of multiple source files, and each source file can only be declared to belong to a package.
After the package import statement, you can call the package level can be exported to the global variables, constants, custom types or functions.
- FourcurriculumTwenty-eight thousand three hundred and eighty-eightStudent