Is the Go language open source?

青灯夜游
Release: 2022-11-30 16:08:39
Original
6737 people have browsed it

The go language is open source. The go language was officially announced in November 2009 as an open source project and implemented on Linux and Mac OS X platforms. Later, the implementation under Windows systems was added; the go language adopts the BSD open source protocol. The BSD open source license is a license that gives users a lot of freedom. They can use it freely, modify the source code, and re-release the modified code as open source or proprietary software.

Is the Go language open source?

The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.

go language--open source programming language


Go (also known as Golang) is a statically strongly typed, compiled, and concurrent type developed by Google. And a programming language with garbage collection capabilities.

Robert Griesemer, Rob Pike and Ken Thompson began designing Go in September 2007, and later Ian Lance Taylor and Russ Cox joined the project. Go is developed based on the Inferno operating system. Go was officially announced in November 2009, becoming an open source project and implemented on Linux and Mac OS X platforms, and later added implementation under Windows systems.

To put it simply: Go language is open source and adopts the BSD license.

BSD open source agreement is an agreement that gives users great freedom. You can use it freely, modify the source code, and re-release the modified code as open source or proprietary software. When you publish code that uses the BSD protocol, or do secondary development of your own products based on the BSD protocol code, you need to meet three conditions:

  • If the re-released product contains If source code is included, the source code must contain the BSD license from the original code.

  • If you redistribute only binary class libraries/software, you need to include the BSD protocol in the original code in the documentation and copyright statement of the class library/software.

  • Do not use the name of the author/organization of the open source code and the name of the original product for marketing purposes.

BSD code encourages code sharing, but the copyright of the code author needs to be respected. BSD is a protocol that is friendly to commercial integration because it allows users to modify and redistribute code, and also allows commercial software to be released and sold using or developed on BSD code. Many companies prefer the BSD protocol when choosing open source products, because they can fully control these third-party codes and can modify or re-develop them when necessary.

Is the Go language open source?

go language description


In 2007, Rob, chief software engineer at Google who was fed up with the suffering of C Pike gathered two talented people, Robert Griesemer and Ken Thompson, and decided to create a new language to replace C. This is Golang. Although the GO language that appeared in the 21st century cannot replace C as expected, its near-C execution performance, near-analytic language development efficiency, and near-perfect compilation speed have become popular all over the world. Especially in cloud projects, most of them are developed using Golang. It must be said that Golang has long been deeply rooted in the hearts of the people. For a new project without historical burden, Golang may be the best choice.

Rob Pike, known as the father of the GO language, said that whether you agree with the GO language depends on whether you agree that less is more or less is less (Less is more or less is less). Rob Pike summarizes the entire design philosophy of the GO language in a very simple way - embodying simplicity and practicality to the fullest.

Many people call GO language the C language of the 21st century, because GO not only has the simplicity and performance of C, but also provides various practical features for server-side development in the 21st century Internet environment. This allows developers to easily get what they want at the language level.

Go language is the second open source programming language released by Google in 2009. The Go language is specially optimized for programming multi-processor system applications. Programs compiled using Go can be as fast as C or C code, are more secure, and support parallel processes.

1. Development team

Is the Go language open source?

The GO language development camp can be said to be unprecedentedly powerful, and there are many major members in the computer software industry. A historical figure who had a profound influence on the development of computer software. Ken Thompson, from Bell Labs, designed the B language and created the Unix operating system (initially implemented in the B language). Later, during the development of Unix, he designed the C language with Dennis Ritchie, and then reconstructed it using the C language. Unix operating system. Dennis Ritchie and Ken Thompson are known as the fathers of Unix and the C language, and were jointly awarded the Turing Award in 1983 in recognition of their outstanding contributions to the development of computer software. Rob Pike, also from Bell Labs, is an important member of the Unix team. He invented the Limbo language and co-designed the UTF-8 encoding with Ken Thompson. He is one of the authors of "Unix Programming Environment" and "Programming Practice".

2. Features of go language

  • Automatic garbage collection reduces the difficulty of development
    Memory and resource management have always been a very frustrating problem problem. In other languages ​​(such as C or C), this memory must be allocated before using it, and then released after use. A small oversight may cause a memory leak, causing the program or even the system to crash. The modern garbage collection mechanism of the Go language significantly reduces the difficulty of development, leaving uninteresting memory management to professional compilers, allowing programmers to focus on more interesting things.

  • Support multiple return values ​​for functions
    Currently, mainstream languages ​​except Python basically do not support multiple return values ​​for functions, but in many cases developers need this feature very much. The multi-return value function of the Go language allows developers to no longer have to define a specific one just to return multiple values.

  • Beautiful error handling specifications
    The Go language introduces the defer keyword It is used for the standard error handling process and provides built-in functions panic and recover to complete the throwing and catching of exceptions. Compared with the exception catching mechanism in languages ​​​​such as C and Java, the error handling mechanism of the Go language can greatly reduce the amount of code. Developers no longer need to add a large number of try-catch statements just for program safety. .
    Golang does not support structured exception resolution methods such as try...catch, because it feels that it will increase the amount of code and will be abused, no matter how small the exception is, it will be thrown. The exception handling method advocated by golang is:

    • Ordinary exception: the callee returns the error object, and the caller determines the error object.
    • Serious exception: refers to an interruptive panic (such as division by 0), which is captured and processed using the defer...recover...panic mechanism. Serious exceptions are generally automatically thrown internally by golang, and do not require users to actively throw them, avoiding the situation where traditional try...catch is written everywhere. Of course, users can also use panic(‘xxxx’) to actively throw, but this will degenerate this mechanism into a structured exception mechanism.
  • Concurrent programming
    The Go language is much simpler than most languages ​​​​in terms of concurrent programming. This is one of its biggest highlights and also its entry into the future. An important bargaining chip in high-concurrency and high-performance scenarios.
    Different from traditional multi-process or multi-thread, golang's concurrent execution unit is a coroutine called goroutine.
    In today's multi-core era, the significance of concurrent programming is self-evident. Of course, many languages ​​support multi-threaded and multi-process programming, but unfortunately, implementing and controlling it is not so easy and pleasant. The difference with Golang is that the language level supports coroutine (goroutine) concurrency (coroutines are also called micro-threads, which are lighter, less expensive, and higher-performance than threads). It is very simple to operate. The language level provides the keyword (go) Used to start coroutines, and thousands of coroutines can be started on the same machine.

  • Network Programming
    Since golang was born in the Internet era, it is inherently decentralized and distributed. One of its specific manifestations is that it provides rich and convenient network programming. Interfaces, such as net.Dial for socket (based on tcp/udp, encapsulating traditional connect, listen, accept and other interfaces), http.Get/Post() for http, client.Call('class_name.method_name', args) for rpc , &reply), etc.

  • Compilation
    Running the compiled Go program does not require additional installation of a running environment such as java's jdk or js's node. At the same time, Go provides native cross-compilation support, cross-compilation The platform is very convenient to develop and deploy.
    Of course, compiling and running is also easier to bring about better operating efficiency, but we cannot be superstitious in this regard. More and more "interpreted" programming language operating environments begin to support JIT, which makes compilation like Go bring The performance advantage becomes less obvious.

3. Go language usage scenarios

In view of the characteristics of Go language and the original intention of its design, Go language, as a server programming language, is very suitable for processing Logs, data packaging, virtual machine processing, file systems, distributed systems, database agents, etc.; in terms of network programming, Go language is widely used in Web applications, API applications, download applications, etc.; in addition, Go language is also suitable for memory In the field of databases and cloud platforms, many foreign cloud platforms are currently developed using Go.

  • Server programming, if you used C or C to do those things in the past, it is very suitable to use Go to do it, such as log processing, data packaging, virtual machine processing, file system, etc.

  • Distributed systems, database agents, middleware, etc., such as Etcd.

  • Network programming, this area is currently the most widely used, including Web applications, API applications, download applications, and Go’s built-in net/http package basically integrates the network functions we usually use All realized.

  • Database operation

  • Develop cloud platform. Currently, many foreign cloud platforms are using Go development.

Implements the business logic of server-side services and is a good alternative to C, Java, Ruby, Python and Php. It can also be used to implement high-concurrency middleware.

Comparison of go language and other open source languages


  • Development efficiency GO language is simple to use and code description High efficiency, unified coding standards, and quick to get started.

##1. Original intention of Go language design

Open go 05. Comparison between Go language and other languages

Reference URL: https://studygolang.com/articles/24885

Go hopes to become the C language of the Internet era.

The fundamental programming philosophy of most system-level languages ​​(including Java and C#) originates from C, further developing C's object-oriented approach. But the designers of the Go language have a different view. They believe that the C language is worth learning. The root of C language's enduring popularity is that it is simple enough. Therefore, the Go language is simple enough. Go was designed by and for those who develop large systems; it is to solve engineering problems, not to study language design; it is to make our programming become More comfort and convenience. **

However, combined with some of Google’s internal realities at the time, such as many engineers coming from the C department, the newly designed language must be easy to learn, preferably a language similar to C; there has been no new language in 20 years language, so the newly designed language must be modern (such as built-in GC) and other situations. Finally, based on practical experience, they designed the Go language toward their goals.

2. Go language and JAVACompiled language, moderate speed (2.67s),

currently Most of the large websites are written in Java, such as Taobao, JD.com, etc. Its main features are stability, good open source, its own set of writing specifications, moderate development efficiency, and it is currently the most mainstream language.

3. Go language and C/C

    C
  • The execution speed is fast (4.28), the learning difficulty is moderate, and the development speed is moderate. However, due to the many shortcomings of C#, the predecessors of large websites such as JD.com and Ctrip were all developed in C#, but now they have been migrated to Java.


  • C/C
  • The ancestor of existing programming languages, from which all other languages ​​are born. The fastest execution speed is unmatched. But it is the most complicated to write and difficult to develop.


  • In terms of language characteristics, Java and C are quite different, while go and C are closer.

4. Go language and pythonHow to choose between python, golang, java and c in 2019?

Reference URL: https://zhuanlan.zhihu.com/p/65177007

Comparative learning: Golang VS Python3
Reference URL: https://zhuanlan.zhihu.com/p/65613337

Both Golang and Python are currently one of the most popular development languages ​​in their respective fields.

Golang’s efficient and friendly syntax has won the favor of many back-end developers and is one of the most suitable languages ​​for high-concurrency network programming.

Needless to say, Python’s top ten permanent residents in the TIOBE rankings have now stabilized in the top five. It has become a must-learn language in the fields of machine learning, AI, and data analysis.

    Compared with python, go has a clear advantage in
  • performance

    , because the running speed of interpreted languages ​​and compiled languages ​​​​is not the same. In addition, go has The syntax is concise and the type system design is better than python.

  • While the performance is strong, the
  • development efficiency

    is not worse than dynamic languages ​​such as Python. It is usually an order of magnitude higher than native Python applications and is suitable for writing some bottleneck services. The memory usage is also very economical.

#Python
Scripting language, the slowest (258s), simple code, short learning progress, and fast development speed. Douban is written in Python. Famous server frameworks for Python include django and flask. However, Python is not stable for large projects, so some companies that use Python later migrated to Java.


【Related recommendations:
Go video tutorial

The above is the detailed content of Is the Go language open source?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template