18 Jun 2015 · Semaphore News

    Introducing Continuous Integration for Go on Semaphore

    4 min read
    Contents

    Golang Continuous Integration & Deployment

    Today we’re happy to announce our next step in platform expansion with full support for continuous integration of Go projects on Semaphore.

    Go: programming language of the future

    Rob Pike described the reason behind creating Go as follows: “The goals of the Go project were to eliminate the slowness and clumsiness of software development at Google, and thereby to make the process more productive and scalable”.

    In addition to being a C-like language with low-level features such as pointers, Go also offers many of the advantages of high-level languages — powerful data structures, duck typing and easy high-level concurrency are just some of them. With this in mind, Go becomes a very interesting solution for many classes of problems, from system tools to web services and distributed systems.

    Continuous integration for Go projects

    As Go has become more mature and gained momentum in the community, now is the right time to bring it to the next level and use it in production-facing applications. A big part of this process is incorporating testing and continuous integration practices in everyday development.

    Semaphore makes getting started with continuous integration easy and intuitive. To add your first Go project on Semaphore, you just need to create a free account, and you’ll be ready to easily add a new project within minutes.

    Semaphore will help you by suggesting optimal build commands for your projects. In the Go community, build commands are pretty standardized. However, if your project needs additional setup, it’s easy to tweak those commands to fit your needs.

    Analysis of an Elixir project on Semaphore

    Semaphore can automatically configure your Go project for continuous integration.

    At this point, you can lean back and watch your Go projects being built on Semaphore.

    Join companies like CoreOS and others who are already testing their Go projects on Semaphore.

    The Go stack

    Semaphore currently includes Go version 1.4 out of the box.

    The $GOPATH environment variable is set to /home/runner/workspace, which contains the standard Go workspace hierarchy (bin, pkg and src folders, etc.).

    Your project’s root directory is represented with a symlink in the src folder of $GOPATH, and all commands are executed from it (by Go convention, it goes as follows: $GOPATH/src///).

    To achieve faster build times, we recommend managing your project’s dependencies with godep so that they are vendored properly. This can reduce your build time by cutting the time needed for downloading dependencies for each build.

    Testing

    One of the big advantages of Go is that it comes prepackaged with testing tools, so there are not many excuses for not testing your code. To test Go applications on Semaphore, just add the following code to your build commands, and you should have your tests running:

    go get -v -d ./...
    go test -v ./...
    

    The three dots (./…) Go wildcard is used to expand to all package directories in your current directory.

    Any additional testing tools like Testify or Ginkgo can be installed easily using the standard go get commands, such as:

    go get github.com/stretchr/testify
    

    If you are using some other tools or dependencies you’d like to be part of the default platform, please let us know.

    Deployment

    Even though Heroku doesn’t have official Go support yet, it’s still an easy way to get started with deploying Go-backed web applications.

    An alternative deployment approach which will be interesting to the Go community is the generic deployment option via SSH. Compile your app, upload it via SSH, and you’re ready to go. Either strategy enables you to ship new features, track releases and get feedback faster than ever, so make sure to try them out.

    We encourage you to contact us with suggestions and feedback. We’d also love to see the setups you use for Go on Semaphore.

    Happy building!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Avatar
    Writen by: