go language module import import

go language go.mod
Insert picture description here

Insert picture description here
Insert picture description here

No matter in which code file, other codes must be imported in the form of moudle/pakagename.
When used

wcms.GetRecord(123) // 这里跟文件名RecordBll没有任何关系。直接用pakagename.方法名

The overall feeling is that the go.mod mode in the go language does fundamentally solve the ease of reuse of the source code when it is introduced. The source code can be reused without adjustments. This is much better than Python's import. It is much more convenient than the include of c and c++.

The role of the file name is weakened in the Go language. Weakened the role of the folder. Emphasizes the importance of unified naming. give it a like

Guess you like

Origin blog.csdn.net/phker/article/details/111352981