This is a creation in Article, where the information may have evolved or changed.
Looking back over the past year, the biggest change we have on the technology stack is switching from node. js to go. Our co-founder, Steve Kaliski, switched node. js to Go in Poptip, but he didn't learn the lessons at the time. After we built the first iteration version of Bowery with node. JS, we switched to go in February 2014, and our development and deployment speed increased. Since then, our entire team has become a full-time Gopher (Translator note: Go mascot). Go clearly defined standards and simpler workflows Let's use go to be comfortable. Here's why we love to work with Go, and you can take a peek at our gopher hole. |
Lj_april Translated 2 weeks ago 1 Person top top translation of good Oh! |
easy to write cross-platform code One of the biggest reasons we switch to go is that it's so easy to compile code for different systems. At Bowery, we are building an app that can help you and your team manage your development environment, and we have to efficiently support all operating systems--linux,windows and OSX. In go, you can define different files for different operating systems, which allows for operating system-dependent functionality. A great example is our companion Larz in the construction of Prompt. Larz wanted to create a go package for cross-platform line editing tips. This is so simple in Go: to create different files for each operating system, the go compiler chooses which files should be used according to the operating system to generate the final content. Compiling code for other systems is just as easy, all you have to do is set up an environment variable, and then you have a Windows binary that you compile on your Linux system. |
Lj_april Translated 2 weeks ago 0 Human Top top Good translation! |
Faster deployment / p> Go is a compiled language and makes it easier to distribute apps across multiple platforms. For us, deployment and testing are important and an asset for our end users. With Go, it's easy to build services and run tests because you're ready to move to the server in your production environment. Go doesn't need any system dependencies, so it's really easy to publish. When you want to publish a command-line tool or other app, our users don't have to worry about installing JAVA,RVM or NPM to run. We liked this article Jeremy Saenz, and he discussed why he migrated all of his command-line tools to go (CLI tools to go). |
jellyfish dry translated 2 weeks ago 0 human top top translation is good Oh! |
concurrency primitive When we switch to go we realize that node. JS's event loop is not everything node. JS does not provide too many concurrent primitives. The only thing that can run at the same time is I/O programs and timers. You cannot communicate through these programs, so use node.js building an agile system is a challenge. With go, you can run any and all of the programs while providing a channel to send signals to the program to do something, or send them some values to share the data. Go also offers like   mutexes ,  wait groups and other low-level concurrency primitives . You may find it on NPM, but we find that the channel is the deciding factor in dealing with concurrency and parallelism. |
jellyfish dry translated 2 weeks ago 0 human top top translation is good Oh! |
Integrated test Framework With node. JS, we already have our test framework choices, but some frameworks are better for the front end, like Jasmine, and other frameworks are better for the backend, such as Mocha. There are other options like Jsunit and Phantomjs, if you've seen StackOverflow's article, there are also many frameworks that are recommended. In some worlds, the choice is a good thing, but when we use go, we like to test the normalization of the framework. In go, all the test packages are built-in. If you need to write a new test suite, you have to add the file (file name) _test.go to the same package as the software you are testing, and it will run every time you execute it go test . You can learn more about go testing at writing tests with go. Need to test HTTP services? Go also offers a httptest package Standard library We like to write most of the software using just the Go standard library. When using node. js, we almost had to introduce an external library, which increased the time to deploy and the potential pitfalls from third-party software. Using only the standard library allows us to write code faster and more secure. |
Dried jellyfish Translated 2 weeks ago 0 Person Top top translation of good Oh! |
more powerful workflow tools for developers node. JS has no real standardized workflow in addition to NPM's packages and scripting controls . In addition, because these tools are created by the community, they are very useful but too many so that the end result is that things are done differently by everyone. A good example of workflow normalization in Go is the layout of the workspace. You have to give up a lot of freedom of development because you have to obeyWork Arealayout, but it provides a lot of structure: You can keep your go source and rely on the same location. In your workspace you have 3 root directories: src putSourceCode Pack, pkg putthe compiledPackage, Binputthe executable program. let your source code and dependenciesputting in a separate workspace is a best practice,Let it be this standard on everyone's machine. These predictability is satisfying in team work. We can go to anyone's machine to help, and know that our code will appear in the path of $gopath/src/github.com/bowery, not other paths like $home/some/path/to/bowery. Similarly, gofmt formats everyone's code in the same way. For some superficial problems, such as organization code and code style differences do not need to worry in go, this is a big liberation. You can focus on fixing your problems, and everything else is taken into account. |
jellyfish stem translated 2 weeks ago 0 Human top top good translation! |
There's a whole bunch of other reasons to like go, and we see more and more companies adopting go to make internal applications stronger and more distributed. But overall, the go team found that developers would be more productive if you created standards and made the case for others to agree. For example, mongodb 's application management team likes to use Go's "smart, unified development experience." in soundcloud, they like to use go strict formatting code rules and "the way to achieve only one" philosophy. This means that you spend less time in code review and controversy over code styles and formats, and more time to solve the root causes of your problems. If you're just starting out with go and want to learn more, here are some resources to look at.
-
Read the Golang official blog update and the core team's announcement
-
Read the core team to provide learning documents on the website
-
We like ardan Studio Bill Kennedy wrote on the blog going Go programming Tips and guidelines for
-
Go by example There's a bunch of different tasks written with go.
-
gopheracademy has a lot of best practices for Go Chapter
-
Brian McCallister has a good article about go workspace and overall development environment
-
More about Go code organization, read Jared Carroll posted in P Ivotal Labs blog articles
If you want to start your first go project, Set up your new environment and share it with your team in Bowery. |
Dried jellyfish Translated 2 weeks ago 0 Person Top top translation of good Oh! |
All translations in this article are for learning and communication purposes only, please be sure to indicate the translator, source, and link to this article.
Our translation work in accordance with the CC agreement, if our work has violated your rights and interests, please contact us promptly