- 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.
推薦閱讀
- Android Wearable Programming
- JavaScript全程指南
- Java EE 6 企業級應用開發教程
- C語言程序設計基礎與實驗指導
- 實用防銹油配方與制備200例
- 微服務設計原理與架構
- Functional Programming in JavaScript
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- Mastering ROS for Robotics Programming
- 第一行代碼 C語言(視頻講解版)
- Microsoft Azure Storage Essentials
- Visual Basic程序設計習題與上機實踐
- Java程序設計與項目案例教程
- Learning Ionic
- Getting Started with JUCE