- Hands-On RESTful Web Services with Go
- Naren Yellavula
- 177字
- 2021-06-24 17:04:26
Installing gorilla/mux
Follow these steps to install the mux package:
- You need to run this command in the Terminal (Mac OS X and Linux):
go get -u github.com/gorilla/mux
- If you get any errors saying package github.com/gorilla/mux: cannot download, $GOPATH not set. For more details see--go help gopath, set the $GOPATH environment variable using the following command:
export GOPATH=~/go
- As we discussed in Chapter 1, Getting Started with REST API Development, all the packages and programs go into GOPATH. It has three folders: bin, pkg, and src. Now, add GOPATH to the PATH variable to use the installed bin files as system utilities that have no ./executable style. Refer to the following command:
PATH="$GOPATH/bin:$PATH"
- These settings stay until you turn off your machine. So, to make it a permanent change, add the preceding line to your bash/zsh profile file:
vi ~/.profile
(or)
vi ~/.zshrc
We can import gorilla/mux in our programs, like this:
import "github.com/gorilla/mux"
Now, we are ready to go. Assuming gorilla/mux is installed, we can now explore its basics.
推薦閱讀
- C語言程序設(shè)計(第2 版)
- Building a RESTful Web Service with Spring
- Developing Mobile Web ArcGIS Applications
- 薛定宇教授大講堂(卷Ⅳ):MATLAB最優(yōu)化計算
- RSpec Essentials
- Angular開發(fā)入門與實戰(zhàn)
- Learning YARN
- Getting Started with Python
- SpringBoot從零開始學(視頻教學版)
- Android Game Programming by Example
- Scala Functional Programming Patterns
- Go語言從入門到精通
- Mastering VMware Horizon 7(Second Edition)
- Puppet:Mastering Infrastructure Automation
- Go Systems Programming