O'Reilly logo

Go Programming Blueprints - Second Edition by Mat Ryer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a server command

So far, all of our service code lives inside the vault package. We are now going to use this package to create a new tool to expose the server functionality.

Create a new folder in vault called cmd, and inside it create another called vaultd. We are going to put our command code inside the vaultd folder because even though the code will be in the main package, the name of the tool will be vaultd by default. If we just put the command in the cmd folder, the tool would be built into a binary called cmd-which is pretty confusing.

Note

In Go projects, if the primary use of the package is to be imported into other programs (such as Go kit), then the root level files should make up the package and will have an appropriate package ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required