cannot find package “github.com/gorilla/mux” in any of:

后端 未结 6 905
慢半拍i
慢半拍i 2021-02-13 04:15

I use command go get github.com/gorilla/mux. I made http server using Golang, and I run this program :

package main

import (
    \"fmt\"
    \"htm         


        
6条回答
  •  鱼传尺愫
    2021-02-13 04:40

    If you are using VS Code as your IDE and facing this problem:

    VS Code uses $HOME/go as your default GOPATH - if you export another GOPATH you running into this trouble.

    How to solve:

    1. Use the VS Code internal terminal and navigate to your project folder: cd prjectFolder. Type go env and check if the GOPATH entry is the same as you get when you use cmd+t and then >Go: Current GOPATH
    2. If it doesn't fit, add in your user settings: "go.gopath": "/some/path" where /some/path is the same path you export in you shell, zsh and so on.

    Hope this helps.

提交回复
热议问题